How to convert a python utc datetime to a local datetime using only python standard library?
- by Nitro Zark
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 reloaded from database to local datetime using the default local timezone (e.g. as if the datetime was create 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 do you get the default local timezone?