Unix Timestamps Explained: Seconds vs Milliseconds, Time Zones and the Year 2038 Problem
When is 1700000000? Why do some systems use 13-digit numbers? Why is the time off by exactly nine hours? Most time bugs disappear once you understand a few concepts.
What a Unix timestamp is
A Unix timestamp (Unix time, epoch time) is a single integer counting the seconds elapsed since 00:00:00 UTC on 1 January 1970, the Unix epoch. 0 is 1970-01-01 00:00:00 UTC and 1700000000 is 2023-11-14 22:13:20 UTC.
Representing a moment as one number has many advantages. The difference between two moments is a single subtraction, sorting and comparison are trivial, and the same instant has the same value everywhere regardless of time zone or date format.
0 → 1970-01-01 00:00:00 UTC
1700000000 → 2023-11-14 22:13:20 UTC
1735689600 → 2025-01-01 00:00:00 UTC
2147483647 → 2038-01-19 03:14:07 UTC
10 digits or 13: seconds or milliseconds?
A present-day timestamp in seconds has 10 digits. JavaScript's Date.now() and Java's System.currentTimeMillis(), however, return milliseconds—13 digits. Mixing them up produces dates like 21 January 1970 or dates fifty thousand years in the future.
Count the digits: 10 means seconds, 13 milliseconds, 16 microseconds. If an API does not document the unit, check it, and multiply or divide by 1,000 when converting.
A timestamp has no time zone
The most important fact is that a timestamp has no time zone. 1700000000 is the same instant in Seoul and in New York. A time zone is applied only when the number is displayed as a human-readable date: the same value is 22:13 in UTC and 07:13 the next morning in Korea (UTC+9).
The classic 'off by nine hours' bug comes from breaking this rule—storing UTC but displaying it as if it were local, or storing a local time string without an offset and reading it as UTC. Store and transmit in UTC (or as timestamps); display in the user's time zone.
Daylight saving time traps
Korea does not currently observe daylight saving time, but the United States and much of Europe move clocks forward in spring and back in autumn. 'New York is 14 hours behind Seoul' is therefore true for only part of the year; the rest of the time the gap is 13 hours.
Use IANA zone names such as America/New_York instead of fixed offsets like -05:00 so transitions are handled automatically. When scheduling meetings with overseas teams or setting up jobs, check the actual offset for that date with a time zone calculator.
The year 2038 problem
Stored as a signed 32-bit integer, a timestamp maxes out at 2,147,483,647, which is 03:14:07 UTC on 19 January 2038. One second later the value overflows to a negative number and jumps back to 1901. This is the year 2038 problem.
Modern operating systems and languages mostly use 64-bit time, but 32-bit values survive in old embedded devices, INT database columns and file formats. Systems that handle far-future dates—long-lived certificates or 30-year loans—can hit the limit today, so use 64-bit integers or proper date types in new designs.
Leap seconds and precision
Unix time treats every day as exactly 86,400 seconds and ignores leap seconds. It can therefore differ very slightly from astronomically precise elapsed time, which ordinary applications can safely ignore. The General Conference on Weights and Measures has decided to abolish leap seconds by 2035.
Paste a number into the AIBIZAP timestamp converter and it detects seconds or milliseconds automatically and shows the date in UTC and your chosen zone. Use the time zone calculator to compare local times and the cron generator for jobs that repeat at fixed times.