Skip to content
All tutorials

/tutorials/unix-time-explained

Unix Time Explained: Why Computers Count from 1970

What a Unix timestamp actually represents, why the count starts where it does, and why so much software relies on it instead of a calendar date directly.

5 min read

Run Timestamp Converter

What a Unix timestamp actually is

A Unix timestamp is simply a count of seconds that have passed since a fixed starting point, midnight, January 1st 1970, in Coordinated Universal Time. The number 1700000000, for instance, represents a specific moment reached by counting that many seconds forward from that starting point, with no calendar, month or timezone involved in the number itself at all.

Why 1970 specifically

The date itself has no special significance. It was simply chosen as a convenient, round starting point by the engineers designing the Unix operating system in the early 1970s, roughly around the time the system itself was actually being built. Once software and file systems began storing dates this way, changing the starting point later would have meant rewriting an enormous amount of existing data and code for no real benefit, so it has remained the standard ever since, well beyond Unix itself, across almost every modern programming language and database.

Why software stores a number instead of a calendar date directly

A single number is trivial to compare, sort and do arithmetic on. Working out whether one moment came before another, or how many seconds separate two events, is a simple subtraction between two timestamps, whereas doing the same comparison directly between two calendar dates, accounting for different month lengths, leap years and time zones, is considerably more work to get right. Storing time as a plain count and only converting it to a readable date when actually displaying it to a person avoids an entire category of date arithmetic bugs.

Seconds versus milliseconds

Most systems use a Unix timestamp measured in whole seconds, which is why a current timestamp is a ten digit number today. JavaScript is a notable exception, and measures time in milliseconds since the same starting point instead, giving a thirteen digit number for the same moment. Mixing the two up, treating a millisecond timestamp as though it were in seconds, produces a date wildly far in the future, which is one of the more common timestamp related bugs.

Trying it yourself

Getting the current Unix timestamp from a terminal

date +%s

The Timestamp Converter accepts either a ten digit seconds value or a thirteen digit milliseconds value and automatically works out which one you have given it, converting it to a readable local time, UTC time and ISO 8601 format all at once.