What is a Unix timestamp?

What epoch time is, how to tell seconds from milliseconds, and how to convert a Unix timestamp to a date.

What a Unix timestamp counts

A Unix timestamp counts seconds from 00:00:00 UTC on January 1, 1970. That instant is the Unix epoch. Under the usual POSIX convention, leap seconds are not counted as additional elapsed Unix seconds.

The number identifies an instant. It does not have a city attached. A timestamp can be displayed as local time in Tokyo or New York without changing which instant it represents.

Seconds or milliseconds?

This is the most common conversion mistake. Many systems store Unix time in seconds. JavaScript’s Date timestamps use milliseconds, with one thousand milliseconds per second.

The instant 2024-01-01T00:00:00Z is 1704067200 in seconds, or 1704067200000 in milliseconds. Picking the wrong unit produces a very different date.

Digit length is a useful clue for modern dates, but it is not a reliable specification. Check the API or database documentation and select the unit explicitly.

What about negative numbers?

A negative timestamp points to an instant before the epoch. For example, −1 second corresponds to 1969-12-31T23:59:59Z. Whether a specific system accepts negative timestamps depends on that system.

Store and log times in UTC

When reading logs from several services, a consistent UTC display avoids mixing local time zones. An ISO 8601-style value ending in Z indicates UTC; an explicit offset such as +05:30 identifies how that displayed local reading relates to UTC.

Our converter labels units and displays UTC explicitly. The reverse conversion also expects a UTC date and time, so your browser’s local zone does not silently change the result.

Open the Unix timestamp converter for both seconds and milliseconds.

Further reading