Time Zones Aren’t Offsets – Offsets Aren’t Time Zones

Breaking Down the Difference

  • A time zone is a place. In fact, the map above pointing out Coral Harbor and Detroit is a map of time zones around the world.
  • An offset is the number of hours or minutes a certain time zone is ahead of or behind GMT**. A time zone’s offset can change throughout the year because of Daylight Saving Time. Sometimes laws change a time zone’s offset or daylight savings pattern. When we say, “Indiana switched from Central to Eastern Time,” we actually mean “Time zones in in Indiana changed from one offset to another.”
  • What about things like “Eastern Standard Time,” “Central Time,” and “Eastern Daylight Saving Time,” you ask? These are abbreviations for offsets that are loosely tied to place. To make our lives harder, they are also called “time zones” in casual conversation. They aren’t a good source of information when we’re programming, because some of them share the same initials, and the places they are associated with can change.

The most important thing we can learn about Coral Harbour and Detroit here is that there is a many-to-many relationship between time zones and offsets. A time zone is a place that can map to different offsets, depending on what time of year it is or which year it is. At any given moment, an offset is usually shared by multiple time zones.

Our Example

America/Coral_Harbour is a time zone (for simplicity, I will focus only on IANA* time zones). America/Detroit is a time zone. With laws as they are now, the America/Coral_Harbour time zone has an unchanging offset of -0500, or five hours “behind” GMT, which for our purposes here matches UTC. America/Detroit changes during the year from an -0400 offset to an -0500 offset. So sometimes, the good people of Coral Harbour and the good people of Detroit have the same offset. Sometimes, they don’t.
Map showing Coral Harbour and Detroit as both being in eastern north America. Coral Harbour has an offset of -0500 and Detroit has offsets of -0400 and -0500.

Another Nuance

Why are there so many time zones that seem to share the same offset? A time zone is a place defined by its offset history. For example, Coral Harbour has not always been five hours behind GMT; for a few months in 1999 and 2000, it was six hours behind GMT. These changes were all legal decisions.

Putting It All Together

Given a time zone and a UTC time, you can know the offset—and therefore the local time. Given a local time and an offset, you can know UTC time, but you do not know which time zone you’re in (because multiple timezones have the same offset). Given UTC and an offset, you can know the local time. Given a time zone and an offset, you don’t know much. That’s why a calendar systems work with time zones, offsets, and UTC; we need the offset to go from local time to UTC, and we need the time zone to go from UTC to local time.

Why the Confusion?

Notice I said, “Sometimes Coral Harbour and Detroit have the same offset, and sometimes they don’t.” Outside of programming, I’d say, “Sometimes Coral Harbour and Detroit have the same time zone, and sometimes they don’t.”

That’s because outside of programming, I’d probably be using these terms to ask a friend for their time zone so I’ll know their offset from my time. If I want to talk to a friend at 6 p.m. my time, what time is it for them? When I know the friend’s time zone, I can map it to their current offset. “Ah, if you’re on Pacific Time, you’re probably three hours behind me in Michigan.”

This shorthand from time zone to offset works in everyday life, but it gets us mixed up when the difference between time zones and offsets matters in programming.

The Importance of Patience

To be patient with time zones, it can help to have some empathy for everyone’s troubles reconciling time and space. My home state, Indiana, is a site of hot debate about whether all or parts of the state should be on Eastern Standard Time (-0400), Eastern Daylight Saving Time (-0400 sometimes, -0500 sometimes), or Central Time (-0600). I grew up on Eastern Standard Time and found the “spring forward/fall back” model unsettling when we switched to Daylight Saving Time.

The debates in Indiana involve everything from reducing two-hour school delays in the winter to syncing with Wall Street versus Chicago, to how late the kids have to stay up for fireworks shows in July. There’s even a coalition trying to bring the whole state back to Central Time. I can delight in all this mess or tear my hair out, and I choose to delight in it!

*IANA (also known as Olson) is one currently reliable and comprehensive database of time zones. You can read about all the other ones here.
**UTC is like a mark in the sands of time. GMT is a time zone with a zero offset from UTC, so you often see it as a default when a system can’t figure out the local time. If you ask too many questions about what exactly UTC is, you will run into the fact that naming moments in time is a human thing we made up. If you want something to distract you from existential confusion, may I suggest learning about UNIX timestamps?

Conversation
  • Steve Dunham says:

    Also, the offset for America/Detroit was -5:32:11 before 1905:

    https://github.com/eggert/tz/blob/master/northamerica#L979

    • Devney Hamilton Devney Hamilton says:

      That’s interesting! Thanks for sharing :)

  • Mr. Brock Peters says:

    That was pretty enlightening. Thanks for doing this blog post. Timezones, timestamps, offsets, etc. are all very confusing to me as I’m trying to learn to program. This really helps put things into perspective.

    I appreciate this.

    Excelsior.

    • Devney Hamilton Devney Hamilton says:

      Thanks for the feedback! Glad you appreciated it.

  • Andrey Kolbasov says:

    Scott Hanselman has a nice podcast about dates and timezones http://hanselminutes.com/485/the-problem-with-datetime-nodatime-with-matt-johnson.

  • Andrew says:

    Thanks for making time and dates just a little less confusing. I know I was using offsets and time zones interchangeably, but no more!

  • Oscar P. says:

    I know I’m a little late in the game here…but great article! Wish I would have found this much sooner!

    Thank you!!!!

  • Comments are closed.