Epoch time (also called Unix time or a Unix timestamp) is the number of seconds that have passed since 00:00:00 UTC on 1 January 1970. That instant is “the epoch”, the zero point everything is measured from. As you read this, the value is somewhere around 1.79 billion.
Why count seconds from 1970?
A moment in time is otherwise surprisingly hard for a computer to store. “9 a.m.” means different things in different places; date strings come in dozens of formats; calendars have leap years and varying month lengths. A single integer sidesteps all of it. To compare two moments, a program just compares two numbers. To find the gap between them, it subtracts. There is no time zone to reconcile and no text to parse first.
The 1970 starting point is a historical accident: it was a round, recent date when the Unix operating system was being built, and it stuck. The count deliberately ignores leap seconds, which keeps the arithmetic simple.
Seconds vs. milliseconds
This trips people up constantly. Unix time is traditionally in seconds, but JavaScript and many APIs use milliseconds, the same count times 1000. A quick way to tell them apart today: a seconds value has about 10 digits, a milliseconds value about 13.
1700000000 → seconds (Nov 2023)
1700000000000 → milliseconds (same instant)Converting a timestamp to a date
In the two most common languages:
// JavaScript: note the * 1000 for milliseconds
new Date(1700000000 * 1000).toISOString();
// "2023-11-14T22:13:20.000Z"
# Python
from datetime import datetime, timezone
datetime.fromtimestamp(1700000000, tz=timezone.utc)
# 2023-11-14 22:13:20+00:00Going the other way, Math.floor(Date.now() / 1000) in JavaScript or int(time.time()) in Python gives you the current epoch time in seconds.
The year 2038 problem
Older systems stored epoch time in a signed 32-bit integer, which runs out of room at 03:14:07 UTC on 19 January 2038. The next second overflows into a negative number, throwing the date back to 1901. The remedy, already standard on modern platforms, is a 64-bit integer, which pushes the limit hundreds of billions of years into the future.
To read or generate an epoch value without doing the arithmetic by hand, use our free Unix timestamp converter. It handles seconds and milliseconds, shows the result in UTC and your local time, and converts in both directions.