How 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 >>>
Tag: timezone
How to get date and time using date command from another timezone in Linux?
Posted ondate command on Linux gets the date and time in the system timezone. But how to get date and time using date command from another timezone in Linux? You can make date print the time of another timezone by setting the TZ environment variable. For example, export TZ=Hongkong; date Sat Dec 1 09:39:13 HKT 2018
Read more
How to Set Date, Time and Timezone in Linux
Posted onHow to set date, time and timezone on Linux/Unix box will be introduced in this post. Unix time, or POSIX time which is a system for describing points in time is the number of seconds elapsed since midnight UTC on the morning of January 1, 1970, not counting leap seconds. The number of seconds elapsed
Read more