What Is a Unix Timestamp?
Learn how Unix time represents an instant, why seconds and milliseconds get confused, and how time zones affect display.
A Unix timestamp is a numeric representation of a point in time measured from the Unix epoch: January 1, 1970 at 00:00:00 UTC. It is popular because computers can compare and sort numbers more easily than dozens of human date formats.
Seconds are the traditional unit
A typical timestamp such as 1789996800 represents seconds since the epoch. Many JavaScript APIs use milliseconds instead, producing a value that is roughly one thousand times larger.
How to spot seconds vs milliseconds
Dates in the current era are commonly around 10 digits in seconds and 13 digits in milliseconds. This is a useful clue, not a formal guarantee for every date range.
The timestamp does not contain a local time zone
It identifies an instant. Your application chooses how to display that instant. The same timestamp can be shown as a different clock time in Regina, Toronto, London, or Tokyo without changing the underlying moment.
UTC vs local display
Logs and APIs often use UTC to avoid ambiguity. User interfaces often convert to the viewer’s local zone. Bugs appear when a system treats a local wall-clock time as if it were already UTC or performs the conversion twice.
Date-only values need different thinking
A birthday such as “September 22” is conceptually a calendar date, not necessarily an instant. Storing it as midnight in one zone and converting zones can make it appear as the previous day elsewhere.
Why timestamps are common in APIs
- Easy numeric comparison
- Compact representation
- Independent of human date formatting
- Convenient duration calculations
The 2038 issue
Older systems using signed 32-bit integers for Unix seconds cannot represent times beyond January 2038. Modern 64-bit systems largely avoid that limitation, but legacy systems can still expose it.
