Fix time bug

This commit is contained in:
xtaodada 2022-03-25 00:31:04 +08:00
parent 3fc8b65fe2
commit a851076a44
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -1,13 +1,13 @@
import pytz
from datetime import datetime, timedelta
pytz.timezone("Asia/Shanghai")
tz = pytz.timezone("Asia/Shanghai")
date_format = "%Y/%m/%d %H:%M:%S"
def strf_time(data: int) -> str:
# data = 1648111686000
ts = datetime.fromtimestamp(data/1000)
ts = datetime.fromtimestamp(data/1000, tz)
return ts.strftime(date_format)