Tom Scott explains for Computerphile why handling time and timezones in code is so hard, walking through a simple web app that computes how long ago something happened. It covers the quirks of timezones and calendars and ends in an exasperated rant.
Why Hacker News points people here: It is the go-to funny, accessible explanation of why you should never implement datetime handling yourself, linked in nearly every timezone thread.
“a must watch for developers just starting out with Timezones”HN comment, 2021
“A brilliant video by Tom Scott for Computerphile”
Tom Scott explains what coding timezones correctly is like, ending in a rant
Full comment
This will probably resonate with people here[1]. A brilliant video by Tom Scott for Computerphile, where he starts to explain what coding timezones correctly is like and by the end of it is in full polite-mini-rant-mode :D [1] this video
Strongly recommendsyborisFeb 2021
“a must watch for developers just starting out with Timezones”
Must-watch for developers starting out with timezones
Full comment
Obligatory post to Computerphile episode about Timezones - a must watch for developers just starting out with Timezones this video
Recommendssk5tDec 2014
“An excellent video touching on some of the intractable aspects of our datetime-marking system's personality quirks”
Explains the quirks of datetime systems
Full comment
An excellent video touching on some of the intractable aspects of our datetime-marking system's personality quirks: this video
RecommendsmyfonjMar 2015
“There is a great (humorous) Computerphile video about this topic”
Humorous take on the problem of time and timezones
Full comment
There is a great (humorous) Computerphile video about this topic: "The Problem with Time & Timezones" [0] [0] this video
Recommendszeta0134Jul 2016
“Computerphile did an excellent overview of time zones and all their complexities in the context of programming”
Overview of time zone complexity including regions that skipped a day
Full comment
Computerphile did an excellent overview of time zones and all their complexities in the context of programming: this video I was quite surprised by some of the stranger rules out there, especially the regions that chose to skip a day for whatever reason. Timezones are complex! Far, far more complex than simple offsets.
RecommendswtfishackernewsNov 2016
“Computerphile / Tom Scott did an excellent video doing that”
Explains to laypeople how hard time handling is
Full comment
>Just try to explain to everyday people just how hard the problem is A bit off topic but Computerphile / Tom Scott did an excellent video doing that this video
RecommendspsteinweberMay 2018
“Same topic, equally entertaining (not AS geeky though).”
Entertaining, less geeky take on same time topic
Full comment
I really enjoyed this. And I think no one mentioned the very related Computerphile video yet: "The Problem with Time & Timezones " this video Same topic, equally entertaining (not AS geeky though).
RecommendsenhdlessOct 2019
“Tom Scott has a pretty good video explaining exactly why writing code about time is not trivial”
Explains why writing code about time is not trivial
Full comment
> such a reasonable, trivial task? Tom Scott has a pretty good video explaining exactly why writing code about time is not trivial: The Problem with Time & Timezones - Computerphile this video
Recommendscoder543Feb 2020
“One commonly referenced YouTube video about time that explains why this is hard”
Commonly referenced explanation of why time handling is hard
Full comment
That’s a hard question regardless of programming language. One commonly referenced YouTube video about time that explains why this is hard: this video A reasonable first approximation of a solution would be to just check every second (or minute, or hour, depending on requirements) whether the current system time is later than the scheduled time for any pending events. Then you probably want to make sure events are marked as completed so they don’t fire again if the clock moves backwards. Trying to predict how many seconds to sleep between now and 3pm on Saturday is a difficult task, but you can probably use a time library to do that if it’s important enough... but what happens when the government suddenly declares a sudden change to the time zone offset between now and then? The predictive solution would wake up at the wrong time.
RecommendsjonathansampsonDec 2021
“It's a fantastic summary of the issues programmers face when dealing with time :)”
Summary of the issues programmers face dealing with time
Full comment
Great question! Dates and times are one of the most loathed obstacles in writing software that needs to work a particular way across millions of devices situated all across the globe in different regions and time zones. In our case, we had a bit of code that aimed to measure the time until midnight/tomorrow. But when clocks change at midnight (jumping forward or backward), you can wind up with days that appear to be longer than 24 hours in length. And when a day is more than ~24hr in length, you wind up with unexpected answers to seemingly simple math equations. A bit of logic, responsible for setting up a timer, wound up scheduling numerous timers when our 'How long until tomorrow' code began returning negative numbers. That set of unintended timers locked-up the application itself. You can see our issue for the behavior here: link . For 10 minutes of anxiety, check out 'The Problem of Time & Timezones' from Tom Scott of Computerphile: this video . It's a fantastic summary of the issues programmers face when dealing with time :) Sampson (Brave Team)
Recommendsbirdman3131Oct 2022
“The sheer amount of growing exasperation as the video goes is hilarious.”
Classic video with growing exasperation about timezones in code
Full comment
I have to toss this classic video on the issues with timezones and programming. The sheer amount of growing exasperation as the video goes is hilarious. this video The Problem with Time & Timezones - Computerphile / Tom Scott
RecommendswolrahMar 2026
“This is a great video explaining a lot of the reasons why time zones are nowhere close to as straightforward as you may think”
Explains why time zones are not as straightforward as they seem
Full comment
That might work for the current form of the country-specific time zones officially acknowledged by countries that exist in TLD form, but the tz database contains many more current time zones more importantly piles of historical time zones. Representing just the historical forms of currently recognized time zones in DNS would be a mess, without even getting in to those that are not associated with a country that currently exists and has a TLD. edit: This is a great video explaining a lot of the reasons why time zones are nowhere close to as straightforward as you may think: this video
Cites itSFJulieDec 2016
“Computerphile what's wrong with timezones”
Cited as background on what is wrong with timezones
Full comment
It does not: timezone (TZ) definitions are politicial, inaccurate, and stupid and non versioned. The problem with TZ is TZ in its core definition. 1) they always change: if you have not updated your TZ since 3 months they are probably inaccurate 2) your TZ definition maybe accurate but they may not have been applied for real in the concerned zone 3) you can have different local time for the same longitude 4) you can have different days on the same longitude ... 5) TZ are not versioned, if the TZ changed between 2 records you may have made, you have inaccurate intervals stored. We do NOT have an API to take TZ change over time in consideration. 6) CEST/DST is breaking the axiom that time is a growing monotonic function References 8.5.3 TZ in postgresql man link Computerphile what's wrong with timezones this video
Cites itfredleyNov 2018
“Computerphile's video on dates and timezones.”
Related video on assumptions programmers make about dates and times
Full comment
Also somewhat related: Computerphile's video on dates and timezones. Programmers might be tempted to make similar assumptions about dates, times and timezones: this video
Cites itcold_factJun 2019
“why I will never implement datetime myself”
Reminder of why to avoid implementing datetime yourself
Full comment
reminds of the Computerphile Tom Scott video "The Problem with Time & Timezones" this video and why I will never implement datetime myself
Cites ittripzilchSep 2019
“(fully) dealing with time zones is an even more maddening incomprehensible quagmire of a task”
Tom Scott conveys how maddening time zones are
Full comment
Really fascinating read. It reminded me of Tom Scott's video on Numberphile, about time zones: this video Maybe it's the way Tom presents it, but I do get the distinct impression that (fully) dealing with time zones is an even more maddening incomprehensible quagmire of a task than rendering text as laid out in this article.
Cites itDavidPeifferFeb 2021
“use their open source code, give them credit, and never worry about it again.”
Conclusion: use an existing time library and never worry again
Full comment
I'm not sure I follow (and this week, timezones and time handling are really important for my job, so I really want to understand)! If a user provides a time of 11/7/2021 1:50 AM America/New_York, how does the library determine if it's a -5 or -4 offset given that's when daylight savings time ends? I believe that's the ambiguity GP is referring to. I'm trying to align time across a few systems I work with. One provides a GMT time with an offset (clean and useful), another system reports timezones and local time, and yet another system has no idea when it moves between time zones, but reports time based on a single timezone consistently. Not dealing with multiple timezones in the past, it reminds me of Tom Scott's video on handling time and timezones, summarized at the end as roughly "Go find someone who built a library for handling times, thank them profusely, use their open source code, give them credit, and never worry about it again." this video
Cites itgobinsSep 2022
“This reminds me of the Numberphile video on date and timezones.”
Related video on dates and timezones
Full comment
This reminds me of the Numberphile video on date and timezones. this video I sometimes wonder how the code to handle all this would look like.
Cites itaz09mugenOct 2024
“Relevant video from computerphile”
Relevant to the mess of time standards
Full comment
They need to do it, but I hope it will be less a mess than we have on Earth with UTC. Relevant video from computerphile : this video
JokeromanhnSep 2022
“My favorite video on the topic.”
Full comment
And just to make sure the aliens lose whatever shred of confidence they might still have in human civilisation, we should introduce them to time zones: this video . My favorite video on the topic.