Unix time explained: what the epoch is and what it leaves out
Unix time is a count of seconds from a fixed starting point. It is simple on purpose, and the simplicity has consequences.
Definition
Unix time counts the seconds since the epoch: 00:00:00 UTC on 1 January 1970. The POSIX standard defines the "seconds since the Epoch" with a formula that turns a UTC date and time into a number, for dates from 1970 onwards, and it states that each and every day shall be accounted for by exactly 86,400 seconds. A date like 14 November 2023 22:13:20 UTC is therefore 1700000000.
What follows from the definition
- Time zones do not appear. The number is the same everywhere at the same instant.
- Daylight saving does not matter. Local clocks jump; the count does not.
- Days are always 86,400 seconds. That makes date arithmetic easy: add 86,400 for one day.
- Leap seconds are not counted. UTC sometimes adds a second at the end of a day; Unix time, as POSIX defines it, has no such second. The page on leap seconds explains the effect.
- Negative values are before 1970 in most systems, although the POSIX text says the relationship is undefined for years before 1970.
The formula in plain words
From the date and time (year, day of the year, hour, minute and second), the number of seconds is: seconds, plus minutes times 60, plus hours times 3,600, plus days of the year times 86,400, plus whole years since 1970 times 31,536,000 (365 days), plus an extra day for every leap year that has passed (every 4th year, except every 100th, but including every 400th). That is exactly the Gregorian calendar rule.
Where you meet it
Databases, file systems (file times), log files, web tokens, APIs and programming languages. Some use milliseconds (JavaScript, Java), microseconds or nanoseconds instead of seconds; always check the unit.
Test it
The converter on this site turns a timestamp into a date and back. We verified it against Python's datetime module on hundreds of random values in ten time zones.
Common mistakes
- Assuming it includes leap seconds.
- Treating it as local time.
- Storing it in a 32-bit signed integer (see the Year 2038 page).
- Mixing the units (seconds and milliseconds).
Who chose 1970?
It was chosen when the system was designed, as a convenient recent start. It has no other special meaning.
Is Unix time the same as UTC?
They are related but not identical: UTC has leap seconds, Unix time does not count them.
Sources
- The Open Group Base Specifications (POSIX.1), section 4.19 "Seconds Since the Epoch" (read 14 November 2026)
This is an independent guide. It is not connected with the IERS, BIPM, IANA, NIST or any company named here. Facts were read on 14 November 2026 from the sources named on each page; calculated values come from Python.