The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Maintaining timestamps for future dates when you know the associated location

Posted by jpluimers on 2021/04/07

For past timestamps (or date-times), as long as you know the associated location, you always know the time zone rule that applies, no matter if you store them in UTC or local time zone.

For future dates, UTC might not be the best option, as you have no knowledge on future time zone rules. There you need to have at least three fields:

  • timestamp
  • time zone delta
  • time zone
  • time zone rules version

Timezone needs to be either in UTC or local time zone; the time zone delta then needs to be applied to either go to local time zone or UTC.

Both John Skeet (Twitter/github/site) and Lau Taarnskov (Twitter/github/site) both wrote great articles explaining this in much greater detail:

The time zone rules version points to the version of the TimeZone database to apply.

Information on the TimeZone database (also known as tzdb, tzdata, the zoneinfo database or IANA time zone database, and Olson database):

--jeroen

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.