Understanding timestamps
Seconds since the epoch.
One number, one moment, no time zone.
The Unix epoch.
A Unix timestamp is a single integer counting the seconds elapsed since midnight UTC on the first of January, 1970 — the Unix epoch. Negative numbers reach into the past; 0 is the epoch itself; today's number is around 1.78 billion. The choice of 1970 was arbitrary — it was a recent past tense to the engineers writing the original Unix.
0 = 1970-01-01T00:00:00 UTC
Why timestamps are inherently UTC.
A Unix timestamp has no time zone. It's the same number, the same moment, anywhere on earth. To turn it into a human-readable date, you pick a time zone and the conversion produces a calendar string. The same timestamp 1735689600 reads as 2025-01-01 00:00 UTC, or 2024-12-31 19:00 EST, or 2025-01-01 09:00 JST. The number didn't move; the rendering did.
Seconds, milliseconds, microseconds.
Different platforms count from the epoch in different units. Unix and most databases use seconds; JavaScript's Date.now() returns milliseconds; some clock libraries go to microseconds or nanoseconds. The easy recognition rule: a timestamp that's about 1.78 × 10⁹ is in seconds; a thousand times larger (1.78 × 10¹²) is in milliseconds; a million times larger still is microseconds.
Same instant, different units
- 1 735 689 600 — seconds
- 1 735 689 600 000 — milliseconds
- 1 735 689 600 000 000 — microseconds
ISO 8601 — the human-readable companion.
When you need a string that reads as a date but parses unambiguously, use ISO 8601: 2025-01-01T00:00:00Z. The T separates date from time; the trailing Z means UTC. An offset like +09:00 replaces the Z when you want to keep a local zone with the string. ISO 8601 is the safest format to put in a JSON payload when both sides need to read it.
2025-01-01T00:00:00Z
The year 2038 problem.
Many older Unix systems stored timestamps in a 32-bit signed integer — which overflows on 19 January 2038, 03:14:07 UTC, after which the counter wraps to a large negative number. Modern 64-bit systems push the overflow out by 292 billion years, but embedded devices, file systems, and binary network protocols built before the late 2010s often still use 32-bit time. If you're reading legacy timestamps near 2.1 billion, you may already be seeing the bug.
Leap seconds (and why most software ignores them).
Strictly, Unix time pretends leap seconds don't exist — there are 86 400 Unix seconds in every day, even on the days that astronomically had 86 401. This causes a small drift between Unix time and atomic time, but everyone agreed long ago that the simplification is worth it. Network time protocols smooth the leap second out across a few hours ("smearing") so that no clock ever sees the actual jump.
What the timestamp doesn't tell you.
A timestamp records a moment in time, full stop. It doesn't record what time zone you were in, what calendar you were using, what the local political authority called that date, or whether daylight saving was in effect. All of those are presentation concerns. The number is the truth; everything else is a rendering.
Read next