mirror of https://github.com/mvt-project/mvt.git
Use backwards-compatible datetime.timezone.utc (#488)
This commit is contained in:
parent
59e6dff1e1
commit
0509eaa162
|
@ -59,13 +59,10 @@ def convert_datetime_to_iso(date_time: datetime.datetime) -> str:
|
||||||
:rtype: str
|
:rtype: str
|
||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
if date_time.tzinfo:
|
||||||
if date_time.tzinfo:
|
# Timezone aware object - convert to UTC
|
||||||
# Timezone aware object - convert to UTC
|
date_time = date_time.astimezone(tz=datetime.timezone.utc)
|
||||||
date_time = date_time.astimezone(tz=datetime.UTC)
|
return date_time.strftime("%Y-%m-%d %H:%M:%S.%f")
|
||||||
return date_time.strftime("%Y-%m-%d %H:%M:%S.%f")
|
|
||||||
except Exception:
|
|
||||||
return ""
|
|
||||||
|
|
||||||
|
|
||||||
def convert_unix_to_utc_datetime(
|
def convert_unix_to_utc_datetime(
|
||||||
|
|
Loading…
Reference in New Issue