Talk
Beginner

The programmers guide to timestamps and time zones

Rejected

Session Description

There are 24 different timezones in the world. And about 70 countries observe daylight savings times. As developers, we have to develop applications that are able to store timestamps generated from anywhere in the world, be it in the past or in the future. Additionally we also have to keep the code and database updated with any changes being made to the timezones and react to those accordingly. And timezone information changes quite often. For example, in 2022, we had 7 changes to the timezone database.

Most of us when asked what timezone we are in, would respond with “IST” but you know that IST isn’t a standardized timezone and can actually refer to Indian Standard Time, Israel Standard Time or Irish Standard Time. How do we handle this in the system?

For countries that observe DST (daylight savings time), when the clocks move forward, an entire hour is usually skipped and when they move backward, an hour occurs twice. So on a move forward day, an appointment scheduled for 3:00PM might actually be an invalid time. And on a move backward day, an appointment scheduled for 3:00PM might occur twice. How do we handle this in the system?

One quick answer, given that all times in the world can be converted into UTC, would be to say “Let’s just store everything in UTC”. But there are problems in taking that approach too which we will discuss in the talk.

Jon Skeet, the author of the leading library to handle dates and times in the .NET world summarizes the date & time problem best by saying: “Either you don’t know it is difficult, or you know it is difficult but you assume that it is so difficult that you’ll never ever get the right answer so you will just be OK with getting things occasionally wrong”.

But there is one way by which we can tame the great date and time beasts - thorough understanding of the concepts.

We will start by looking at some of the most common questions that come up when dealing with parsing, storing and interacting with dates and times:

  • What are timezones?

  • What is daylight savings time?

  • How do I store timestamps in the database?

  • Why can’t I just store UTC everywhere?

  • How often do things change in the world?

  • Why is this so hard?

All these are very normal questions to ask. And they cause problems when not handled properly in production.

Another very subtle but important nuance for this conference is that we live in a country (India) which only has 1 timezone and where daylight savings isn’t observed. Hence, we have the privilege of having to never “change” our watches and clocks unless we go our of our country somewhere. So unless we have some prior experience with dealing with date and time in software systems, most of us (me included) start in the dark.

Building software however expects a clean understanding of dates and times and the associated nuances.

Key Takeaways

This session aims to address 3 key points:

  1. Introduce the audience to the concepts around time and date and timestamps

  2. Highlight the complexities that arise from storing timestamps

  3. Give practical advise on how to solve the complexities predictably in a production scenario

This talk aims to equip the audience with the concepts and knowledge they need to solve date and time problems in any environment / language they work in. There will also be code samples to better illustrate the concepts.

References

Session Categories

Engineering practice - productivity, debugging
Which track are you applying for?
Main track

Speakers

Shrayas
Head of Engineering
https://twitter.com/shrayasr
Shrayas

Reviews

0 %
Approvability
0
Approvals
2
Rejections
3
Not Sure

This is a fun topic to talk about at programming conferences. Its not super FOSS focused and may be a little too introductory.

Reviewer #1
Not Sure

A good intro/basic session on topic but not really FOSS focused conversation

Reviewer #2
Not Sure

Its an overall good topic to discuss for awareness about tzdb. Like other reviewers i am not sure if we can put this one out into main track

Reviewer #3
Not Sure

This would suit the Open Data Dev Room if the talk can focus more on tzdb.

Reviewer #4
Rejected

While the topic was considered a good introduction, it lacked a clear FOSS focus. For future submissions, we recommend that you either reframe your talk to have a stronger FOSS-specific angle or consider submitting to a more relevant Devroom.

Reviewer #5
Rejected