Skip to main content

🧭 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 NameIANA IdentifierSDT OffsetDST Offset
Eastern TimeAmerica/New_York−05:00−04:00
Central TimeAmerica/Chicago−06:00−05:00
Mountain TimeAmerica/Denver−07:00−06:00
Arizona TimeAmerica/Phoenix−07:00−07:00
Pacific TimeAmerica/Los_Angeles−08:00−07:00
Hawaii Standard TimePacific/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 offsetsAsia/Kathmandu sits at UTC+05:45, Asia/Kolkata at UTC+05:30. Plenty of code assumes offsets are whole or half hours.
  • Non-hour DST jumpsAustralia/Lord_Howe is 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/Troll uses a 2-hour DST jump.
  • DST at unusual timesAmerica/Nuuk transitions at -1:00 (23:00 the previous day); older parsers may reject negative hours. Africa/Cairo and America/Santiago transition at 24:00 (next day); some parsers clamp to 23:59.
  • Lunar-calendar DSTAfrica/Casablanca and Asia/Gaza pause DST during Ramadan, which follows the Islamic lunar calendar and drifts against the Gregorian year. Rules are hard-coded in tzdb through 2086.
  • Ambiguous abbreviationsCST maps 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:60 parses.
  • UTC ≠ GMT — They are often conflated but are distinct. Use UTC in code and storage.

References