Skip to main content

What Is Unix Time?

A plain-language explanation of Unix time, the epoch and why programs count time this way.

The short definition

Unix time is the number of seconds that have passed since 00:00:00 UTC on 1 January 1970. That starting moment is called the Unix epoch. The number 0 means the epoch itself, 86400 means exactly one day later, and 1790000000 means about 56 years and 9 months after it.

Because the count is a single integer that does not change with location, it is easy to store, sort and compare. Two servers on opposite sides of the world that read the same Unix timestamp are talking about the same instant, even if their clocks show different hours.

Why 1 January 1970?

The starting point was a practical choice by the early Unix developers, not a historical event. Early versions counted time in sixtieths of a second, which overflowed within a few years, so later versions switched to whole seconds and settled on 1970 as the reference. The convention spread to C, POSIX, Linux, macOS, databases and most web technologies, and it is still the default today.

Leap seconds and time zones

Unix time treats every day as exactly 86,400 seconds. Real clocks occasionally add a leap second to stay aligned with the Earth's rotation; systems handle it by repeating a second or by smearing it over several hours. For everyday work you can ignore this, but it means Unix time is not a perfect count of physical seconds.

A Unix timestamp has no time zone. A time zone only enters the picture when you turn the number into a calendar date and clock reading. The same timestamp is 14:13 in London and 09:13 in New York on the same day, and it is still the same timestamp.

Dates before 1970 and very large values

Moments before the epoch are negative numbers: -86400 is 31 December 1969 00:00:00 UTC. Systems that store the value in a signed 32-bit integer can represent dates only from 1901 to 2038, which is the cause of the Year 2038 problem. Modern languages use 64-bit values that cover far more than the range of the calendar.

Where you will meet it

Log files, database columns, API responses, JSON Web Tokens (the exp and iat claims), file metadata, cache headers and cron-style schedulers all use Unix timestamps. Some use seconds and some use milliseconds, which is the most common source of confusion; the guide on seconds versus milliseconds shows how to tell them apart.