I have something like
from dateutil import parser
my_datetime = parser.parse("2020-06-19 12:10:10.12345+02")
I want to print this as 2020-06-19 10:10:10.12345Z
I have something like
from dateutil import parser
my_datetime = parser.parse("2020-06-19 12:10:10.12345+02")
I want to print this as 2020-06-19 10:10:10.12345Z
You can use dateutil.tz
to access timezones and then express a given date with that timezone with .astimezone()
.
from dateutil.parser import parse
from dateutil.tz import tzutc
my_datetime = parse("2020-06-19 12:10:10.12345+02")
print(my_datetime.astimezone(tzutc()))