I’m receiving a date in a fixed timezone. I need to convert it to the local machine’s timezone, but I don’t know what that is. How can I do this using pytz (not dateutil)? I’ve found plenty of solutions which use dateutil, e.g. this answer, but I can’t find a similar function in pytz.
Share
You can convert via a (UTC) Unix timestamp:
This uses the solution from Python Create unix timestamp five minutes in the future.
Note that this won’t tell you what the local timezone is, although you can find out its offset from UTC at that time using: