1.存入数据库前转换为utc时间。
This commit is contained in:
parent
22b24c28b4
commit
dcc7f3d186
4
model.py
4
model.py
|
|
@ -7,10 +7,10 @@ mysql_db = MySQLDatabase(
|
|||
|
||||
|
||||
def add_record(execution_datetime,server, speed):
|
||||
execution_datetime_timestamp = execution_datetime.strftime("%Y-%m-%d %H:%M:%S")
|
||||
execution_datetime_utc = execution_datetime-datetime.timedelta(hours=8)#转换为UTC时间。
|
||||
# print(now_timestamp)
|
||||
mysql_db.execute_sql(
|
||||
'insert into vps_download_speed(server,speed,datetime) values("{server}",{speed},"{datetime}")'.format(
|
||||
server=server, speed=speed, datetime=execution_datetime_timestamp
|
||||
server=server, speed=speed, datetime=execution_datetime_utc
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue