Skip to tool
ecech.
🕑 Date, Time & Timezone

At 03:14:08 on 19 January 2038, a 32-Bit Clock Reads 1901

It does not crash. It wraps to minus two billion and reports a date 137 years in the past, which is far harder to notice.

Overflows at

Time left

Then reads

not an error, a wrong date

Total span

How close your horizon is

Every common limit

Advertisement

How the calculation works

One second later 2147483647 2038-01-19 03:14:07 UTC +1 s -2147483648 1901-12-13 20:45:52 UTC No exception, no crash. A date 137 years in the past, which passes every sanity check that only asks whether it parsed. Anything computing a 30-year term is already producing values past 2038 today.

How to Use This Tool

Pick an integer width, a tick rate and an epoch. The countdown is to the moment the counter can no longer represent the current time.

What actually happens in 2038

A signed 32-bit integer reaches 2,147,483,647. Counting seconds from 1970, that is 2038-01-19T03:14:07Z. Add one second and the bit pattern becomes −2,147,483,648, which reads as 1901-12-13T20:45:52Z.

The important part is that nothing fails. No exception is raised, no value is out of range, and the result is a perfectly well-formed date. Every check that only asks "did this parse" passes.

Downstream, a certificate looks expired, an account looks 137 years old, a scheduled job looks overdue, and an interval calculation goes hugely negative. Tracing any of those back to an integer width is slow work.

It is not a 2038 problem, it is a today problem

Systems fail when they first compute a date beyond the limit, not when the limit arrives.

  • A 30-year mortgage signed today matures in 2056.
  • A 20-year certificate or long-lived key already crosses it.
  • Anything with a far-future "not before" or "never expires" placeholder does the same.

Those calculations are happening now, which is why the useful question is not how many years remain but how far ahead your software looks.

Same 32 bits, different tick rate seconds 68 years — runs out in 2038 milliseconds 24.9 days Which is why long-running embedded devices misbehave about once a month, and why a reboot appears to fix it.
A thousand times the resolution costs a thousand times the range.

The rollover nobody plans for

Signed 32-bit milliseconds reach their limit after 2,147,483,647 milliseconds — 24.9 days. Unsigned, it is 49.7 days.

This is the classic embedded and long-uptime bug. A device works perfectly in testing, runs for a month, and then does something inexplicable involving a negative elapsed time. Rebooting fixes it, which makes it very hard to reproduce and very easy to dismiss.

The safe pattern is to compare elapsed times as (now − then) in unsigned arithmetic rather than testing now > deadline, because the subtraction stays correct across a single wrap and the comparison does not.

What 64 bits buys

  • Signed 64-bit seconds — roughly 292 billion years. Not a problem anyone needs to think about again.
  • Signed 64-bit nanoseconds — 2262-04-11. Finite, and used by several languages and databases for high-resolution timestamps. Two hundred years is comfortable and it is not forever.
  • JavaScript numbers hold integers exactly to 253, so millisecond timestamps are safe for about 285,000 years while microsecond ones are not.

What to actually do

Fixing this is rarely about the language and almost always about storage and interfaces:

  • Database columns. A 32-bit integer timestamp column is the usual culprit, and changing it means a migration rather than a recompile.
  • Wire formats and file formats. Anything with a fixed layout has the width baked in, and both ends have to agree before it changes.
  • Embedded devices that cannot be updated at all, which is the part of the problem that does not get solved by anyone deciding to solve it.

Testing is straightforward and rarely done: set a system clock to 2038-01-19 and run the suite.

Advertisement

Frequently Asked Questions

What exactly happens in 2038?
A signed 32-bit second counter reaches 2,147,483,647 at 2038-01-19T03:14:07Z. One second later it wraps to −2,147,483,648, which reads as 1901-12-13T20:45:52Z. Nothing crashes — it just reports a date 137 years in the past.
Is the 2038 problem still a problem?
Yes, and it starts before 2038. Systems fail when they first compute a date past the limit, so a 30-year mortgage signed today or a 20-year certificate already crosses it. The question is how far ahead your software looks, not how many years remain.
When does a 32-bit millisecond counter overflow?
After 2,147,483,647 milliseconds, which is 24.9 days signed or 49.7 days unsigned. It is the classic long-uptime bug: a device works for a month, then produces a negative elapsed time, and rebooting appears to fix it.
Does 64-bit time solve it permanently?
For seconds, effectively — signed 64-bit seconds last about 292 billion years. For nanoseconds it does not: signed 64-bit nanoseconds run out on 2262-04-11, which several languages and databases use for high-resolution timestamps.
How do I avoid millisecond rollover bugs?
Compare elapsed time as (now − then) in unsigned arithmetic rather than testing whether now is past a deadline. The subtraction stays correct across a single wrap; the comparison does not.
How do I test for 2038 problems?
Set a system clock to 2038-01-19 and run your test suite. It is simple and rarely done. The harder part is storage — a 32-bit timestamp column needs a migration, and fixed wire formats need both ends changed together.

Related tools in Date, Time & Timezone

Browse all Date, Time & Timezone tools
The Mac mini the ecech. site is built on, beside a handwritten note reading ecech.com.

Made by one person

ecech. is not a content farm. Every tool here is written and checked by hand, one at a time, by someone who wanted the tool to exist and could not find a version that showed its working.

No accounts and no sign-in, and nothing you type reaches a server — every calculation on this page runs inside your browser. The ads are served by Google and do set their own cookies, which is set out in full on the privacy page. More about the site.