A Day Has Only 24±1 Hours: import pytz

June 30, 2018, 4 p.m. - 4:30 p.m.

Many people in Central Europe complain about two clock changes per year in March and in October that are known in advance and your system handles them without problems. As a developer, you should probably fear more all the clock changes you don’t know about…

After a short overview of the standard datetime module and its usage in different geographical contexts, we’ll have a look at the pytz library and discover all the 591 timezones it comes with. We’ll see why pytz is not a part of the standard library, as well as when and how and why this package gets frequent updates. This may be useful if your web app provides any timezones related functionality.

Background: I’ve spent most of my life in one time zone and travelled only a few times to another one. But I work daily with measurement data from sensors that are set to any random clock and have to interpret them correctly.

Miroslav Šedivý

Born in Czechoslovakia, studied in France, living in Germany. Using Python to make the sun shine and the wind blow. hjkl juggler and languages enthusiast.

Get PyConWeb event announcements

No spam, 2-3 emails per year