Skip to content
BENIBIX Learn

Unix Timestamp

Development📄 Files & FormatsData Formats

Also known as Unix Time, Epoch Time, POSIX Time

A time written as the seconds since 1 January 1970 UTC. One number, the same everywhere.

Think of it like

Think of it like a stopwatch that was started long ago. It has never stopped.

Example

Jack's app logs 1700000000 for a sign-up. A tool reads it back as 14 November 2023, 22:13 UTC.

Why it matters

Two timestamps can be subtracted to get the seconds between them. No time zones or calendars get in the way.

Definition

A Unix timestamp counts the seconds since midnight on 1 January 1970, in UTC. That starting point is called the epoch. So any moment is one whole number, like 1700000000. It is the same number in every time zone. Computers find it easy to store, compare and subtract. Some systems count in milliseconds instead, which adds three digits.

Example code

console
$ date -u -d @1700000000 '+%Y-%m-%d %H:%M:%S'
2023-11-14 22:13:20
The number 1700000000 turned back into a date and time people can read.
On the left, one moment as a Unix timestamp. On the right, the same moment as a date.

Common mistake

Mixing up seconds and thousandths of a second. Read the wrong way, a time lands far in the future.

Key takeaways

  1. 1
    Counts seconds. From the start of 1970 in UTC.
  2. 2
    No time zones. One number everywhere on Earth.
  3. 3
    Watch the unit. Milliseconds are a thousand times bigger.

Learn it properly