DateBuffet

Understanding Unix Timestamps (Epoch Time)

5 min readUpdated September 2026
Code on a computer screen

Almost every system logs time as a Unix timestamp — a plain integer. It is compact, timezone-free and easy to compare, which is why developers reach for it constantly. Once you know how it is defined, converting it back to a human date is trivial.

Seconds since 1970

A Unix timestamp is the number of seconds that have elapsed since 00:00:00 UTC on January 1, 1970 — a moment called the Unix epoch. So 1000000000 corresponds to September 9, 2001. Because it is measured in UTC, the same timestamp represents the same instant everywhere; your local clock just displays it differently.

The value carries no calendar, no offset and no daylight-saving rule, which is precisely why systems like it: two timestamps can be compared or subtracted with ordinary arithmetic. Values below zero are perfectly legal and describe moments before 1970 — minus 86400 is December 31, 1969 — although older libraries have a poor record of handling them correctly.

A few round numbers are worth recognising on sight. 1000000000 fell on September 9, 2001; 1234567890 on February 13, 2009; and 2000000000 lands on May 18, 2033. Anything near 1.7 or 1.8 billion is a recent moment expressed in seconds, and anything past four billion is either far in the future or not a second-based timestamp at all.

Seconds or milliseconds?

This trips people up constantly. Unix time is classically in seconds, but JavaScript and many APIs use milliseconds — a number that is 1000× larger. A rule of thumb: a 10-digit number is seconds, a 13-digit number is milliseconds. DateBuffet auto-detects which you pasted and shows both.

Two finer units turn up as well. Microsecond timestamps have sixteen digits and appear in PostgreSQL internals and browser tracing formats; nanosecond timestamps have nineteen and come from Go, Linux system calls and several time-series databases. The quickest diagnostic is to convert and look at the year: read milliseconds as seconds and you land tens of thousands of years in the future, read seconds as milliseconds and you land in January 1970.

The year 2038 problem

Older systems store the timestamp in a signed 32-bit integer, which overflows on January 19, 2038. Modern platforms use 64-bit integers and are safe for billions of years. It rarely affects everyday work, but it explains why timestamp handling is taken seriously in long-lived systems.

The same limit has a lower end: a signed 32-bit count cannot reach back beyond December 13, 1901, which is why some older systems refuse nineteenth-century birth dates. Databases inherit the range from their column types — MySQL's TIMESTAMP stops at January 19, 2038 while DATETIME does not — so the choice of column, rather than the language, often decides whether a far-future date survives a round trip.

Leap seconds, and why Unix time ignores them

Unix time is defined so that every day contains exactly 86,400 seconds. The Earth's rotation does not cooperate, so since 1972 timekeepers have inserted 27 leap seconds into UTC, the most recent at the end of 2016. A Unix timestamp simply steps over them: during an inserted second the count either repeats a value or is slowed down, depending on the system, and the gap between UTC and atomic time TAI now stands at 37 seconds.

Large operators work around this with a leap smear, spreading the extra second across a whole day so that clocks never step backwards; while it is happening, machines inside a smeared network disagree with the outside world by up to half a second. The practice may soon be unnecessary: in November 2022 the General Conference on Weights and Measures resolved to stop inserting leap seconds by 2035.

From a timestamp to a wall clock

Turning a timestamp into a readable date needs two extra inputs: a time zone and a copy of the rules for it. Those rules live in the IANA time zone database, republished several times a year as governments change offsets, move daylight-saving dates or create new zones. A device holding a stale copy converts the same timestamp into the wrong local time, and nothing in the number itself reveals the error.

The reverse direction is worse, because local time is not a function. When clocks go back, a local time such as 01:30 occurs twice and maps to two different timestamps; when they go forward, the skipped hour maps to none at all. Storing the instant itself — or the local time together with its zone identifier — removes the need to guess which of the two a string meant.

When a timestamp is the wrong tool

Timestamps are ideal for things that happened: log lines, payments, message ordering. They fit badly for things that are scheduled. A meeting at 09:00 in Berlin next March is a local commitment, and if Germany changes its daylight-saving rules before then, the UTC instant computed today points at the wrong hour. Store the local date-time and the zone identifier, and resolve the instant when you actually need it.

Calendar dates deserve the same care. A birthday or an invoice date has no time of day, and storing it as midnight turns it into a timestamp that shifts to the previous day for anyone west of the server that wrote it. Keep date-only values as dates, and reserve timestamps for genuine instants.

Other epochs you will meet

Unix is not the only origin point. Windows FILETIME counts 100-nanosecond intervals from January 1, 1601; .NET ticks run from the year 1; Apple's Cocoa frameworks measure seconds from January 1, 2001; GPS time started on January 6, 1980 and, unlike UTC, never pauses for a leap second. When a converted value comes out in 1601 or 2001, you are usually holding one of these rather than a corrupted Unix timestamp.

Text formats travel alongside the numbers. RFC 3339 and ISO 8601 write the same instant as 2026-09-20T14:30:00Z or with an explicit offset such as +03:00; both are unambiguous, whereas a string with no offset is worth only as much as the assumption a reader makes about it. If a log mixes formats, normalise everything to one of them before comparing anything.

The takeaway

A Unix timestamp is seconds since 1970-01-01 UTC; watch out for milliseconds (13 digits). Paste any value into the Unix timestamp tool to convert it both ways.

Related tool
Unix Timestamp

Convert between Unix timestamps and human-readable dates.