how to get tz_info object corresponding to current timezone?

Viewed 32860

Is there a cross-platform function in python (or pytz) that returns a tzinfo object corresponding to the timezone currently set on the computer?

environment variables cannot be counted on as they are not cross-platform

8 Answers

Python 3.7:

import datetime

datetime.datetime.now().astimezone().tzinfo
Related