What Is a Unix Timestamp, and Why Does It Start in 1970?
A count of seconds since an arbitrary Tuesday. Why that date was chosen, what the format deliberately ignores, and what breaks in 2038.
· 2 min read
A Unix timestamp is a single integer: the number of seconds elapsed since midnight UTC on the first of January 1970. That is all it is. Every date you have ever seen rendered by a computer probably began life as one of these numbers, and most of the format’s usefulness comes from what it refuses to represent.
Why 1970?
It was convenient rather than meaningful. Early Unix development needed an origin close enough to the present that a small counter would not overflow immediately, and the start of the decade in which the work was happening was the obvious round number. There is no astronomical or historical significance to it: the epoch is an arbitrary Thursday that stuck because everything built afterwards agreed on it.
What it deliberately does not encode
A timestamp has no time zone, no daylight saving rule, no calendar and no locale. It is a point on a line, identical everywhere on Earth at the same instant. Those things are presentation, applied when the number is displayed. Storing a timestamp and formatting it late is what makes a system survive a country changing its clock rules, which countries do more often than most developers expect.
0 1970-01-01T00:00:00Z
1000000000 2001-09-09T01:46:40Z
2147483647 2038-01-19T03:14:07Z <- the 32-bit ceilingThe 2038 problem
Stored in a signed 32-bit integer, the count runs out on the 19th of January 2038, when it overflows and wraps to a negative number — placing the date in 1901. Modern systems use 64-bit integers and the problem disappears for longer than the sun has left. It survives in embedded devices, old file formats and database columns chosen decades ago, which is exactly where nobody is looking.
The epoch is not a moment in history. It is an agreement about where to start counting.
Seconds or milliseconds?
Unix counts seconds; JavaScript counts milliseconds. Confusing the two produces dates in 1970 or far in the future, and it is the most common timestamp bug there is. A quick check: a current timestamp in seconds has ten digits, and one in milliseconds has thirteen. Anything with a different length is almost certainly being interpreted in the wrong unit.
The leap second it quietly ignores
Unix time assumes every day contains exactly 86,400 seconds, which is not quite true — leap seconds are occasionally added to keep clocks aligned with the Earth’s rotation. Rather than represent them, Unix time repeats or stretches a second so the arithmetic stays simple. It is a deliberate inaccuracy, chosen because a timestamp that needed a leap-second table to do subtraction would be far worse than one that is off by a handful of seconds across half a century.
Frequently asked questions
- Can a Unix timestamp be negative?
- Yes. Negative values represent dates before 1970, counting backwards in seconds. Support varies between languages and databases, so dates before the epoch are worth testing rather than assuming.
- Should I store dates as timestamps or as strings?
- Store the instant, not the rendering. A timestamp or a proper timestamp column sorts and subtracts correctly, whereas a formatted string carries a time zone and a locale into your data and has to be parsed back before any arithmetic.
- Why does my date show as 1970?
- Almost always a null, a zero, or milliseconds being read as seconds. A value of zero is the epoch itself, which is why a missing date so often renders as the first of January 1970 rather than as an error.
Related reading
- 2 min read
Hex, RGB, HSL or OKLCH: Which Should You Use?
Four ways to write the same colour, with different strengths. Why HSL lies about brightness, and what OKLCH fixes that the others cannot.
- 2 min read
How Long Does It Take to Double Your Money?
The rule of 72 answers it in your head, and it is accurate enough to be useful. Where it comes from, where it drifts, and what it quietly assumes.
- 2 min read
How Long Should a Password Be in 2026?
Why length beats complexity, what entropy actually measures, and how to pick a password length that will still hold up in ten years.
- 2 min read
How Much Should You Tip? What Custom Actually Says
Tipping norms differ enormously by country, and the reason is structural rather than cultural. How to work out the right amount somewhere unfamiliar.