Ask experienced programmers what the hardest thing in their job is and a startling number of them say the same thing: dates. Not graphics, not security, not speed. Working out what day it is.
A computer counts. A date is a number. Adding one day to a number ought to be the least interesting thing a machine ever does.
And yet time is where careful software goes to fall over, over and over, in ways that make the news. There is a reason, and it is not a technical one at all.
Every other thing a computer measures was there before us. A metre is a length. A kilogram is a mass. We chose the names and the sizes, but the underlying things are simply out there, indifferent to us, behaving identically whatever anyone votes.
A date is not like that. A date is an agreement — and the agreement has been rewritten, argued over, and locally ignored for two thousand years, and it is still being changed today.
A computer can only be as exact as the rules it was given. Time's rules were made up by people, and people keep changing them.
A year is not a whole number of days. The Earth takes roughly 365 and a quarter days to get round the Sun, so we add a day every four years to soak up the quarters.
Except the leftover is not exactly a quarter, so that overcorrects. The rule we actually use has two exceptions stacked on it:
So 1900 had no 29th of February, and 2000 did. Two century years, a hundred years apart, behaving oppositely — and a rule that sounds like somebody arguing with themselves.
And this is the simple part of timekeeping. It is written down, it never changes, and every programmer has heard of it. It still causes bugs, because a great many people learn only the first line of it.
A programmer writes only the first line of the rule: a leap year is any year that divides by 4. Their calendar is used for dates between 1901 and 2099. Will anyone ever notice?
Now a genuinely strange one. The world's most-used spreadsheet believes that 1900 was a leap year. It will happily show you the 29th of February 1900, a date that has never existed.
This is not an oversight. It was copied deliberately from an earlier spreadsheet that had the bug, so that files and formulas moving between the two would agree with each other. Microsoft has said as much in public.
And it cannot be fixed now. Somewhere in the world are millions of spreadsheets whose numbers quietly depend on that extra day. Correcting the bug would shift dates in files that people have been relying on for decades — so a wrong day sits permanently in one of the most-used pieces of software ever written, and everybody involved knows.
That is worth sitting with for a moment. Being right is not always the highest priority. Sometimes agreeing with what already exists wins.
Surely a day is 86,400 seconds. Twenty-four hours, sixty minutes, sixty seconds — that is just arithmetic.
But the second has been defined since 1967 by the vibrations of a caesium atom, which is genuinely fixed, while the Earth's spin is not. It wobbles. The oceans and the atmosphere shove it about; earthquakes change it slightly; the Moon's pull has been slowing it over geological time. Our rotation and our clocks drift apart by fractions of a second a year, in a way nobody can predict far ahead.
So since 1972 there has been a committee that occasionally announces an extra second — a leap second — to be inserted into a particular minute, making that one minute 61 seconds long. Twenty-seven of them have been added. The last was at the end of 2016.
When one arrived in 2012, a string of large websites and airline check-in systems fell over, because software that has only ever seen 60-second minutes tends to react badly to a clock that repeats itself. And unlike leap years, these cannot be worked out in advance. There is no formula. A committee looks at the measurements and decides, usually about six months ahead.
In 2022 the international body responsible finally voted to stop, by 2035 at the latest — an admission that a rule where the answer is announced by a committee twice a year is not something software can be expected to live with.
There is no such thing as 3 o'clock. There is 3 o'clock somewhere, and the somewhere is decided by law.
Time zones are not neat hourly slices of the planet. Nepal is 5 hours and 45 minutes ahead of the world's reference clock. India is 5 and a half. The Chatham Islands are 12 and three quarters. These are not rounding errors — they are decisions, made by governments, that a computer has no way to work out for itself and must simply be told.
Then there are the clock changes, which start and stop on different dates in different countries, get suspended, get abolished, get reinstated. Somebody has to notice each change and update a shared file that most of the world's software quietly depends on.
And occasionally a country does something bigger. At the end of 2011 Samoa decided it was on the wrong side of the international date line for trading with its neighbours, and jumped across. To do it, the country skipped the 30th of December entirely. That date has no Samoan history at all — no births, no weather, nothing. It did not happen there.
A computer cannot derive any of this. There is nothing to derive. It is all just what people decided.
An app stores a dentist appointment as the text '3pm on 5 November, Chicago time'. Months before it happens, the government changes the date the clocks move. What has happened to the appointment?
Every one of these is a real change to how time is counted, made by people, and every one of them is something software has had to be told about rather than work out. Put them in order.
Tap whichever you think happened next
The year 2000 problem is remembered as a joke, mostly because so little happened — which is a strange way to judge an emergency that thousands of engineers spent years preventing. Estimates for the United States alone run to around 100 billion dollars of work, and countries that spent far less had noticeably more trouble.
The cause was mundane. Storing a year as two digits was a completely sensible decision when computer memory was staggeringly expensive and the software was not expected to last thirty years. It saved real money. And then the software lasted.
The 2038 problem is the same mistake in a different costume. Enormous numbers of systems track time as a count of seconds since the beginning of 1970, in a space that holds numbers up to a little over two billion. That is fine for about sixty-eight years. Sixty-eight years from 1970 is 2038, and on the 19th of January that year the counter runs out of room.
Both of these are a number given exactly enough space for the range somebody expected, meeting a world that carried on regardless. Nobody was careless. Every one of those decisions was reasonable on the day it was made — and time is the one thing guaranteed to keep going after the person who made the decision has stopped.
You are writing a program that will record when things happened. Given everything here, which decision is most likely to cause somebody trouble in twenty years?
You’re previewing as a parent — nothing here is recorded.
The Gregorian leap-year rule: a year is a leap year if divisible by 4, except years divisible by 100, except again years divisible by 400. 1900 was therefore not a leap year and 2000 was. Between 1901 and 2099 the only century year is 2000, which is divisible by 400 — so the shortened 'divisible by 4' rule gives identical results across that entire range, which is why the shortcut is so common and so long-lived. The Gregorian reform of 1582: in the countries that adopted it immediately, Thursday 4 October 1582 was followed by Friday 15 October 1582, deleting ten dates. Britain and its colonies adopted it in 1752, by which point eleven days were needed: Wednesday 2 September 1752 was followed by Thursday 14 September 1752. Microsoft has publicly documented that Excel intentionally treats 1900 as a leap year, allowing the non-existent date 29 February 1900, for compatibility with Lotus 1-2-3, and that correcting it would break existing spreadsheets and serial-number arithmetic. Leap seconds: the SI second has been defined by a caesium-133 transition since 1967, while the Earth's rotation varies unpredictably. The first leap second was inserted on 30 June 1972 and 27 have been added in total, the most recent on 31 December 2016. The 30 June 2012 leap second caused documented outages at a number of large websites and at airline check-in systems, because software did not handle a repeated or 61-second minute. In November 2022 the General Conference on Weights and Measures (CGPM) resolved to stop the use of leap seconds by 2035 at the latest. Time zone offsets are set by governments, not geography: Nepal is UTC+05:45, India UTC+05:30, and the Chatham Islands UTC+12:45. Most software depends on a shared, human-maintained database of these rules, which is updated whenever a country changes its clocks or its offset. Samoa moved to the west side of the international date line by skipping 30 December 2011 entirely. Y2K: two-digit year storage was widespread when memory was extremely costly. US Department of Commerce estimates put the cost of remediation in the United States at roughly 100 billion dollars. The scarcity of visible failures is generally attributed to that remediation rather than to the risk having been imaginary. The 2038 problem: systems storing time as a signed 32-bit count of seconds since 00:00:00 UTC on 1 January 1970 overflow at 03:14:07 UTC on 19 January 2038, which is about 2.147 billion seconds, or roughly 68 years, after the start point. The standard fix is a 64-bit counter, whose range extends far beyond any plausible use.