user613122
user613122

Reputation: 13

timezone handling in python

I have an application in python wherein I've to convert between different time zones. I intend to use tz database from http://www.twinsun.com/tz/tz-link.htm as it is periodically updated.

Is there a compiler which reads tz database files directly so that updated files can be downloaded periodically and used without much effort. One of the compilers available is pytz but it may require more than just downloading new files.

Upvotes: 1

Views: 344

Answers (2)

Lennart Regebro
Lennart Regebro

Reputation: 172179

pytz includes the database files, and a new version of pytz is released when the tz/zoneinfo/Olsen database updates. The 2011b release of the database was released the 7th of February and pytz2011b was released the day after. Hence, you can just use the latest version of pytz, and you are done.

pytz also includes not just the database, but timezone classes to use with Pythons datetime, so it's (almost) everything you need for timezone issues in Python.

Upvotes: 3

AndiDog
AndiDog

Reputation: 70108

If you want to use pytz anyway, then why not periodically update that package as it already contains the most recent timezone definitions. You could accomplish this with regular calls to pip install --upgrade pytz, for example.

Of course this will only update the timezones once a new pytz release is out.

Upvotes: 3

Related Questions