🧭 Timezone
Timezones are defined and manged by IANA under BCP 175.
tip
- Timezones change over time very often. The way you convert time between zone today, does not apply in the past or future.
- Always use libraries.
- Curious how one area's timezone change over time? Source code often denote history!
🇺🇸 United States
| Common Name | IANA Identifier | SDT Offset | DST Offset |
|---|---|---|---|
| Eastern Time | America/New_York | −05:00 | −04:00 |
| Central Time | America/Chicago | −06:00 | −05:00 |
| Mountain Time | America/Denver | −07:00 | −06:00 |
| Arizona Time | America/Phoenix | −07:00 | −07:00 |
| Pacific Time | America/Los_Angeles | −08:00 | −07:00 |
| Hawaii Standard Time | Pacific/Honolulu | −10:00 | −10:00 |
Edge Cases
If your code touches timezones, these real-world cases are worth covering. Most naive implementations break on at least one.
- Non-hour offsets —
Asia/Kathmandusits at UTC+05:45,Asia/Kolkataat UTC+05:30. Plenty of code assumes offsets are whole or half hours. - Non-hour DST jumps —
Australia/Lord_Howeis the only timezone with a 30-minute DST transition (UTC+10:30 ↔ UTC+11:00); hourly cron jobs will not align with wall-clock hours across the transition.Antarctica/Trolluses a 2-hour DST jump. - DST at unusual times —
America/Nuuktransitions at-1:00(23:00 the previous day); older parsers may reject negative hours.Africa/CairoandAmerica/Santiagotransition at24:00(next day); some parsers clamp to23:59. - Lunar-calendar DST —
Africa/CasablancaandAsia/Gazapause DST during Ramadan, which follows the Islamic lunar calendar and drifts against the Gregorian year. Rules are hard-coded in tzdb through 2086. - Ambiguous abbreviations —
CSTmaps to 66 different zones (China, Cuba, multiple Americas). Never identify a zone by abbreviation — use the IANA identifier. - Leap seconds — Most runtimes cannot represent a 61-second minute. Production systems typically smear leap seconds across a window rather than inserting them. Do not assume
23:59:60parses. - UTC ≠ GMT — They are often conflated but are distinct. Use UTC in code and storage.