The Problem with Time & Timezones - Computerphile

Channel:Computerphile · Length:10:12 · Published:2013-12-30 · Views:4409354

Watch on YouTube

Summary

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 HN recommends it

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, 2021

Python, Ruby & scripting languages · Software (other)

Subtitles (excerpt)

Sooner or later, every programmer has to deal with time zones. And I can't really offer much advice here; I can offer a cautionary tale. I can tell you why you really should never, ever deal with time zones if you can help it. Let's imagine that someone has built an application that lets you calculate how many seconds something is in the past. You type in a date and a time, it gives you the number of seconds. And they look at that and think "OK, that kind of works for me..." "But let's add a little box that lets you change the time zone" So if you're comparing between now in New York and five days ago in London, you can work that out. And that's fine - the little drop down lets you change which hour forward or backward of Greenwich you are. Brilliant. Sooner or later, after it gets a bit popular, they'll get a call from Australia. And Australia will say "G'day ma--" -- I'm not gonna try and do accents. I just shouldn't do accents. Australia will say "Hello!" "By the way, we're 9½ hours ahead of Greenwich." And the programmer will go "really?" "Yeah, 9½ hours." "OK, I'll add a special case for you. That's fine." A little bit later, someone will call from Nepal. And they'll say "Hello. We're 5¼ hours ahead of Greenwich."

On Hacker News

Obligatory post to Computerphile episode about Timezones - a must watch for developers just starting out with Timezones [VIDEO] — yboris, 2021-02
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] [VIDEO] — tehmaco, 2015-01
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… — wolrah, 2026-03
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. [VIDEO] The Problem with Time & Timezones - Computerphile / Tom Scott — birdman3131, 2022-10
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 da… — jonathansampson, 2021-12

Related videos