Brought to you by Linode - Build your next big idea @

Unlock the mysteries of time, Python's datetime that is!

Episode #271, published Sat, Jul 4, 2020, recorded Thu, Jun 18, 2020.

This episode is carbon neutral.
Time is a simple thing, right? And working with it in Python is great. You just import datetime and then (somewhat oddly) use the datetime class from that module.

Oh except, there are times with timezones, and times without. And why is there a total_seconds() but not total_minutes(), hours() or days() on timedelta? How about computing the number of weeks?

What if you wanted to iterate over the next 22 workdays, skipping weekends?

Ok, we'd better talk about time in Python! Good thing Paul Ganssle is here. He's a core developer who controls time in CPython.

Links from the show

Talk Python Training Humble Bundle:

Paul on Twitter: @pganssle
Paul's Blog:
Paul's Website:

Datetime blog posts
pytz: The fastest footgun in the West:
Stop using utcnow and utcfromtimestamp:
A curious case of non-transitive datetime comparison:
Semantics of timezone-aware datetime arithmetic:


PEP 495: Local time disambiguation:
PEP 615: Support for the IANA Time Zone Database in the Standard Library:

zoneinfo documentation in Python 3.9:

Extra libraries

Indiana Time Zones:

Paul Ganssle
Paul Ganssle
Paul is the maintainer of the dateutil package and also a maintainer of the setuptools project.
Episode sponsored by
Ads served ethically
Click to show comments

Individuals can support this podcast directly via Patreon. Corporate sponsorship opportunities available here.
Become a friend of the show
Stay in the know and get a chance to win our contests.
See our privacy statement about email communications.