Python and timezones

tonetheman profile image Tony Colston ・1 min read

I recently needed to see what time it was in another timezone. Again this is a good task for Python (everything is really).

There is a great package named pendulum that is made exactly for this.

See here: https://pendulum.eustace.io/

So if I need to know what time it is in Japan...

import pendulum
now_in_japan = pendulum.now("Japan")

That is easy to read and showed me exactly what I wanted.

Also if you want to know what timezones your system knows about look in /usr/share/zoneinfo. Not sure about windows :(


markdown guide