Time Zones in Python: Everything You Wish You Didn't Need
summary
Covers practical pitfalls when working with time zones in Python using zoneinfo (Python 3.9), the PyPI tzdata package, and the fold attribute (Python 3.6). Gives concrete examples — zones that skip whole days (Kiribati) or apply DST twice (Morocco), a reproduced bug causing non‑transitive datetime equality with a detailed debugging trace, a created map of standard‑hour offsets, and explicit rules for when to store local time versus converting to UTC for correct comparisons and arithmetic.
AI-written summary · about
chapters (15)
- 0:00Time zones intro
- 1:30UTC basics
- 2:32Abbreviations confusion
- 4:18Daylight saving changes
- 6:49China and Kiribati extremes
- 8:13Why not UTC
- 10:01Python timezone model
- 12:55Ambiguous and imaginary times
- 15:47Python pitfalls
- 18:16Local timezone support
- 20:02IANA timezone data
- 21:52Time comparisons confusion
- 24:42Datetime equality and math
- 26:28Best practices
- 26:52Conclusion
related talks
30mWorking with Time Zones: Everything You Wish You Didn't Need to Know
26mHandling Timezones in Python
41mimport time_travel: A Primer on Timezones in Python
45mEverything You Never Wanted to Know About Time Zones
18mManaging Time like a Time Lord: It's bigger on the inside
27mThe time paradox: Building Timezone-safe python/django applications.
09mA Day Has Only 24±1 Hours
38mA Matter of Time
