Skip to content

Commit

Permalink
fixed plugin bug: Change the time to output the time in the GMT+8 tim…
Browse files Browse the repository at this point in the history
…e zone
  • Loading branch information
yym68686 committed Dec 18, 2023
1 parent 4484efc commit a1f2c59
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions utils/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,12 +519,15 @@ def check_json(json_data):

def get_date_time_weekday():
import datetime

now = datetime.datetime.now()
import pytz
tz = pytz.timezone('Asia/Shanghai') # 为东八区设置时区
now = datetime.datetime.now(tz) # 获取东八区当前时间
weekday = now.weekday()
weekday_str = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'][weekday]
return "今天是:" + str(now.date()) + ",现在的时间是:" + str(now.time()) + "," + weekday_str
return "今天是:" + str(now.date()) + ",现在的时间是:" + str(now.time())[:-13] + "," + weekday_str

# 使用函数
print(get_date_time_weekday())
def get_version_info():
import subprocess
current_directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand Down

0 comments on commit a1f2c59

Please sign in to comment.