I have a python datetime
instance that was created using datetime.utcnow()
and persisted in database.
For display, I would like to convert the datetime
instance retrieved from the database to local datetime
using the default local timezone (i.e., as if the datetime
was created using datetime.now()
).
How can I convert the UTC datetime
to a local datetime
using only python standard library (e.g., no pytz
dependency)?
It seems one solution would be to use datetime.astimezone(tz)
, but how would you get the default local timezone?