Course contentsShow
← Web Development
Lesson 2752 of 2,98249. Dates, Times, and Numbers on the WebFree lesson

Named Timezones vs Offsets

Understand the difference between IANA timezone names and fixed UTC offsets, and why names are preferred.

Named Timezones vs Offsets

You'll learn why IANA timezone names like "America/New_York" are more reliable than fixed UTC offsets like "-05:00" for web applications.

The Core Difference

A UTC offset is a simple number: how many hours (and minutes) ahead or behind UTC a location is at this moment. For example, "-05:00" means five hours behind UTC.

A named timezone (from the IANA timezone database) is a string like "America/New_York" that represents an entire region's ruleset — including historical changes, daylight saving time (DST) transitions, and political decisions about time.

Why Offsets Alone Are Dangerous

Think of an offset like knowing someone is "currently 10 miles north" versus a timezone name being their full address. The offset changes depending on DST, but the address stays constant.

Example problem: New York is UTC-5 in winter but UTC-4 in summer (DST). If you store only "-05:00" with a summer date, you've locked in the wrong offset — the date will display incorrectly when rendered later.

Named timezones solve this: "America/New_York" automatically applies the correct offset for any date, past or future, because the timezone database knows all the rules.

When to Use Each

  • Use named timezones when storing recurring events, user preferences, or any date that needs correct DST handling across seasons
  • Offsets are only safe for instantaneous timestamps that won't be interpreted in different contexts

You've already used Intl.DateTimeFormat with the timeZone option — it accepts IANA names, not offsets, precisely because names preserve semantic meaning across time.

Key Takeaway: Always prefer IANA timezone names over fixed UTC offsets when storing or manipulating dates — offsets are snapshots, but names are rules that work correctly across all dates and DST transitions.