We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Talks - Paul Ganssle: Working with Time Zones: Everything You Wish You Didn't Need to Know
Learn everything you wish you didn't need to know about time zones, including non-standard offsets, daylight saving time rules, and navigating complexities with Python libraries and datetime arithmetic.
- Time zones are not divided into 24 equal-sized zones, each one hour apart from UTC; instead, some time zones have half-hour or quarter-hour offsets.
- Not all time zones use daylight saving time (DST); some may use different rules for adjusting local time.
- UTC is not a natural abstraction for most of the world, as many regions use non-standard time zones or have complex DST rules.
-
The
tz
library in Python represents a set of rules for mapping wall time to a series of offsets, but this can be confusing and may not accurately reflect all possible time zone scenarios. -
datetime
arithmetic can be tricky, especially when dealing with DST transitions or non-standard time zones. -
The
ZoneInfo
library provides a more accurate and user-friendly way to work with time zones in Python. - There are several different ways to represent time zones in Python, each with its own strengths and weaknesses.
-
Using a third-party library like
PyTZ
can help mitigate some of the complexities of working with time zones in Python. - Some time zones have complex DST rules or non-standard time offsets, which can require extra care when working with dates and times.
-
The
fold
attribute in thedatetime
library can help resolve ambiguous time zone transitions. -
The
ZoneInfo
library is designed to be more compatible with other libraries and is a good choice for working with time zones in Python.