What Is Unix Time?
· fundamentalsutc
A single integer that identifies any instant, anywhere on Earth, with no time zone attached. Here is where it came from and what it deliberately leaves out.
Unix time is the number of seconds that have elapsed since 00:00:00 UTC on 1 January 1970, not counting leap seconds. That reference moment is called the Unix epoch, and the counter has been ticking upward once per second ever since.
At the time of writing that number is around 1.77 billion. It goes up by one every second, forever, with no wrapping, no reset at midnight and no notion of a calendar.
Why a single integer
The design decision that makes Unix time useful is what it omits. A Unix timestamp carries:
- no time zone
- no calendar system
- no locale or formatting
- no daylight saving state
It is a pure point on a universal timeline. When a server in Frankfurt writes 1710050400 to a database and a client in São Paulo reads it, both refer to precisely the same instant without having agreed on anything beforehand. Time zones enter the picture only at the very edges of a system, when a human needs to read the value.
Compare that with storing "10/03/2024 11:30". Is that March or October? Whose clock? Was daylight saving in effect? Every one of those questions is a bug waiting to happen, and none of them exist for an integer.
Where the epoch came from
The choice of 1970 was pragmatic rather than principled. Early Unix at Bell Labs used a 32-bit counter ticking 60 times a second, which covered barely two and a half years — so the epoch had to be re-based constantly. Moving to whole seconds stretched the range to about 136 years, and 1970 was picked simply as a convenient round year near the start of the project. It was never meant to be permanent, and it has now outlived every system it was designed for.
The leap second omission
This is the part that surprises people. Unix time asserts that every day contains exactly 86,400 seconds. Real solar days do not — the Earth’s rotation is slightly irregular, so the international timekeeping authorities occasionally insert a leap second into UTC to keep atomic time aligned with astronomical time.
Unix time does not represent leap seconds at all. When one occurs, the counter simply repeats a value: the same timestamp covers two distinct real seconds. This means:
- Unix time is not a true count of elapsed physical seconds since 1970. It is off by the number of leap seconds inserted since then (currently 27).
- Subtracting two timestamps gives a duration that may be a second or two short across a leap second boundary.
- For nearly all software, none of this matters. For satellite navigation, financial exchange sequencing and distributed consensus, it matters a great deal.
The trade was deliberate: perfect arithmetic simplicity in exchange for a tiny, well-understood inaccuracy. See leap seconds for the full story, including why the practice is being abolished in 2035.
Reading a timestamp by eye
You can date a timestamp roughly from its digit count and leading digits alone:
| Value | Instant | Note |
|---|---|---|
0 |
1 Jan 1970, 00:00:00 UTC | The epoch. In production, usually an unset field. |
1000000000 |
9 Sep 2001, 01:46:40 UTC | The first billion. |
1700000000 |
14 Nov 2023, 22:13:20 UTC | Ten digits starting 17 is “recent”. |
2147483647 |
19 Jan 2038, 03:14:07 UTC | The signed 32-bit ceiling. |
A 13-digit value is milliseconds, 16 is microseconds, 19 is nanoseconds. That heuristic is what the converter uses to auto-detect units, and it is reliable for any date in the modern era.
Negative timestamps
Values below zero represent instants before 1970. -86400 is 31 December 1969. This works correctly in most modern languages, but plenty of systems reject or mangle negatives — which is why historical dates, and birth dates in particular, are a recurring source of bugs. There is a separate guide on negative timestamps.
What it is not
Two clarifications worth stating plainly, because both cause real confusion:
Unix time is not UTC. UTC is a time standard with a calendar, zones, leap seconds and a defined string representation. Unix time is a counter. You convert between them; they are not the same kind of object.
Unix time is not monotonic. It reads the system clock, which can be adjusted backwards by NTP, by a virtual machine resuming from a snapshot, or by a user. Never measure elapsed time by subtracting two wall-clock timestamps — use your platform’s monotonic clock (CLOCK_MONOTONIC, performance.now(), time.monotonic()) for that.
Where to go next
- Seconds vs milliseconds — the most common timestamp bug in existence
- The Year 2038 problem — what happens when a 32-bit counter runs out
- Convert a timestamp now — the interactive tool