How to get date and time from another timezone in Python?
Posted on In TutorialHow to get the date and time from another timezone in Python?
You may use the pytz library. Example usage as follows.
$ python3
Python 3.8.2 (default, Jul 16 2020, 14:00:26)
>>> from datetime import datetime
>>> import pytz
>>>
>>> print(datetime.now(pytz.timezone('Europe/Amsterdam')).strftime('%Y-%m-%d %H:%M:%S %Z%z'))
2020-08-09 15:50:00 CEST+0200
>>>