learning-it by example

Back to the video

Python Dates and Time Zones: 5 Bugs Reproduced

Add one day to a London time across the clock change, and only 23 real hours pass.

Video #140 ยท Python for data

Steps in the video

  1. 0:00 Across the clock change, one day is 23 hours
  2. 0:33 The idea
  3. 0:59 Setup
  4. 1:24 Two zones and two helpers
  5. 1:51 Bugs one and two
  6. 2:48 One day across the clock change
  7. 3:46 Twice, and never
  8. 4:43 What this does not show
  9. 5:13 Mistakes to avoid
  10. 5:44 My take and next steps
  11. 6:11 Recap

Files

  • run.py (44 lines)
  • zones.py (17 lines)

Download the code (zip)

Tested with

Python 3.12.15 | tzdata==2026.5

What this does not show

Two zones and a few made-up 2026 times on one Windows run; it does not test other countries' rules, databases or calendars.

Sources

Learning IT by Example.