DEV Community

Tony Colston
Tony Colston

Posted on

Python and timezones

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:

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

import pendulum
now_in_japan ="Japan")
Enter fullscreen mode Exit fullscreen mode

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 :(

Top comments (0)