Skip to content

Unix Time and the Year 2038 Problem

Unix time is a single number counting seconds since 1970, and on January 19, 2038 the 32-bit version runs out. Here is what that means, why it already breaks things, and how it gets fixed.

· 9 min read · Gabriel

Close-up of a wall calendar grid showing dates and a Wednesday column header
Table of Contents

A clock that is really a single number

Almost every device you have touched today agrees on one number. Not the time in your city, not your calendar, not your time zone, but a single whole number that counts the seconds since midnight on January 1, 1970, in UTC. That number is called Unix time, and right now it is a ten-digit figure that climbs by one every second.

It is an elegant idea. Instead of storing “Tuesday, 3 PM in New York” with all of its human rules, a machine remembers something like 1771200000. One instant, one number, no ambiguity. Your server in Frankfurt, your phone in Lima, and a sensor in a factory all agree on it even when their wall clocks show different things. You can watch the current number and translate it into a readable date in our Unix timestamp converter.

The catch is that a number that only goes up eventually runs out of room. And for one very specific, very common way of storing Unix time, we know exactly when: 03:14:07 UTC on January 19, 2038.

Why 1970

The starting point, called the epoch, is January 1, 1970. There is nothing cosmic about it. In the early 1970s, the engineers building Unix at Bell Labs needed a convenient, recent zero date, and a round start of a decade did the job. Moments before 1970 are simply represented with negative numbers.

That modest decision spread across the entire digital world. Today Unix time lives inside databases, network protocols, file systems, logs, and the firmware of devices its inventors never imagined. The origin date almost never matters. What matters is how much room the computer set aside to hold the number.

The number that runs out

For decades, the common way to store Unix time was a signed 32-bit integer. “Signed” means one bit is spent on telling positive numbers from negative ones, which leaves a maximum value of 2,147,483,647. That is how many seconds the counter can hold.

Add 2,147,483,647 seconds to midnight in 1970 and you arrive at 03:14:07 UTC on Tuesday, January 19, 2038. One second later, the counter overflows. Because the sign bit flips, the number does not roll on to 2,147,483,648: it turns negative and lands on December 13, 1901. Picture the odometer of an old car rolling from 999999 to 000000, except this car suddenly reappears in the previous century.

One detail delights enthusiasts: the cutoff time is 03:14:07, that is 3, 14, 7, a nod to the first digits of pi. Unix time has several of these celebrated moments, and the 2038 one is simply the first that breaks things instead of decorating a t-shirt.

Unix time valueMoment (UTC)Why it is remembered
0January 1, 1970, 00:00:00The epoch: the second zero that everything hangs from.
1,000,000,000September 9, 2001, 01:46:40The “Unix billennium”, celebrated by programmers.
1,234,567,890February 13, 2009, 23:31:30A tidy run of digits; there were genuine parties.
2,147,483,647January 19, 2038, 03:14:07The signed 32-bit ceiling: the Year 2038 problem.

Why this is not Y2K wearing a new costume

It is tempting to file this next to the Year 2000 bug and move on. But they are different problems. Y2K was a human convention: software stored years with two digits, so “99” rolled to “00” and the computer could not tell whether it meant 1900 or 2000. It was a formatting problem, mostly in the layer where people read and write dates.

The Year 2038 sits deeper. It is not about how a date is displayed; it is about the fundamental unit the machine uses to count time. You cannot fix it by writing four-digit years on a screen. You have to enlarge the container that holds the number itself.

Year 2000Year 2038
Root of the problemYears stored with two digitsSeconds stored in a signed 32-bit integer
Layer affectedFormatting and displayThe data type and underlying storage
Typical fixUse four-digit yearsUse 64-bit integers for time
Harder part to changeApplication logicOn-disk formats, protocols, and old devices

The strange part: 2038 is already breaking things

The subtle mistake is to treat this as a distant cliff. It is not. Any system that calculates dates into the future already crosses the 2038 boundary today. A thirty-year mortgage signed in 2026 computes due dates past 2038. A certificate, a warranty, an insurance policy, or a long subscription does arithmetic that steps over the limit long before the date itself arrives.

That is why isolated failures have already happened: a system trying to represent “twenty years from now” in a 32-bit integer suddenly gets a date in 1901, a negative duration, or an inexplicable error. The Year 2038 does not wait for 2038. It arrives early for any code that looks far enough ahead.

Where it really hurts, and where it does not

The good news is that your laptop and phone are almost certainly fine. Modern 64-bit operating systems already store Unix time in 64-bit integers. JavaScript counts time in milliseconds inside a floating-point number that has no trouble until hundreds of thousands of years from now. Python uses integers with unlimited precision. For most up-to-date software, 2038 is a footnote.

The danger lives elsewhere: in 32-bit devices with long lives and rare updates. Routers, industrial controllers, smart meters, medical equipment, car control units, and sensors that get installed and forgotten for twenty or thirty years. And in formats: fixed 32-bit date fields inside files, network protocols, old file systems, and database columns designed long ago. The processor may be ready, but data saved in the old format does not repair itself.

The fix is boring, and that is good

The main solution is simple to describe: store time in a signed 64-bit integer instead of 32. That stretches the counter's reach to about 292 billion years, far past the age of the universe. There is nothing new to invent; you simply give the number more room.

Much of that work is already done. The Linux kernel spent years making even 32-bit platforms 2038-safe, the standard libraries were updated, and the BSDs did the same. The hard part is not the processors but the data at rest: migrating file formats, protocols, and old devices without breaking everything that already depends on them. It is quiet, unglamorous, deeply useful work, exactly what good infrastructure engineering should be.

What you can actually do

  • Check whether your language or database stores time in 32 or 64 bits, especially on older systems.
  • Find any place where you calculate dates years or decades ahead; that code crosses 2038 today.
  • Look at embedded devices and firmware with long lifespans, where updates are rare.
  • Treat dates on disk and in protocols as contracts: changing the size of a time field affects everything that reads it.
  • Test your system clock past 2038 in a controlled environment to see what breaks before it matters.

A number worth watching

The Year 2038 problem is a good reminder that digital time is a human choice, not a law of nature. We decided to count seconds, decided to start in 1970, and decided how many bits to spend on it. Each of those decisions was reasonable when it was made, and each leaves a fingerprint that lasts for decades.

Meanwhile the counter keeps climbing quietly, one second per second. If you are curious to watch it, see the current number in our Unix timestamp converter, confirm today's date, or work out the time until a future date with the deadline calculator. And if the time bugs that already break software today interest you, our guide to the most common date and time bugs carries the story forward.

Further reading

Year 2038 quiz

1. What does Unix time count?
2. Why does the Year 2038 problem happen?
3. When does 32-bit Unix time overflow?
4. How is 2038 different from the Year 2000 bug?
5. Why can 2038 cause bugs today?

← Back to all articles