DateTimeOffset Confusion

For many years, dates, times, time zones, new language date types such as datetimeoffset have confused developers. I am writing this in hopes that you can refresh some details about the often used datetimeoffset type.

- December 11, 2019

Rest of the Story:

Consider the following timestamp: 1995-07-14T13:05:00.0000000-03:00.
When asked what the -03:00 at the end is called, many developers answer, “a time zone.”

The -03:00 does represent the offset from UTC. To get the UTC time, invert the offset sign then add it to the time such as 13:05 + 3 = 16:05 in UTC.

Okay, following this ok now more details..

The mistake is in thinking that the offset is all there is to a time zone. Nope.

A time zone is a geographical area, and it consists of many pieces of information, such as

  • One or more offsets. (DST is a thing, after all.)
  • The dates when DST transitions happen. (These can and do change whenever governments feel like it.)
  • The amount of time applied when transitions happened. (It’s not one hour everywhere.)
  • The historical records of changes to the above rules.

In short, is is not possible to establish the time zone by the offset!