Fix a bug
This commit is contained in:
parent
7921e259e2
commit
c895b0be13
@ -5,7 +5,10 @@ date_format = "%Y-%m-%dT%H:%M:%SZ"
|
||||
|
||||
def strf_time(data: str) -> str:
|
||||
# data = "2021-07-17T09:14:05Z"
|
||||
ts = datetime.strptime(data, date_format)
|
||||
if data:
|
||||
ts = datetime.strptime(data, date_format)
|
||||
else:
|
||||
return "未知"
|
||||
# UTC+8
|
||||
ts = ts + timedelta(hours=8)
|
||||
return ts.strftime("%Y/%m/%d %H:%M:%S")
|
||||
|
Loading…
Reference in New Issue
Block a user