Unix Timestamp (Epoch Time) Explained

A Unix timestamp compresses any instant into a single integer: the number of seconds elapsed since 1 January 1970 at 00:00 UTC. That simplicity hides a few sharp edges — units, time zones, and integer size. This guide explains what the number means, how to read it, and where conversions usually go wrong.

What Exactly Is a Unix Timestamp?

A Unix timestamp (also called epoch time) counts the seconds since 1970-01-01T00:00:00Z, the Unix epoch. The count runs on UTC, so it is the same number in every country at the same instant. It can be negative for moments before 1970, and it is always a duration, never a formatted date. 1700000000 is not "a time in London"; it is an absolute instant that each time zone renders differently.

Seconds, Milliseconds, or Microseconds?

The same instant can be written with different precision: seconds (1700000000, 10 digits), milliseconds (1700000000000, 13), microseconds (16), or nanoseconds (19). JavaScript's Date.now(), Java's System.currentTimeMillis() and many APIs use milliseconds; date +%s and most Unix tools use seconds. Count the digits as a first sanity check. Feeding seconds to a millisecond API dates the value to January 1970, while feeding milliseconds to a seconds API pushes it tens of thousands of years into the future. Divide or multiply by 1000 before converting.

Why Does the Same Timestamp Show a Different Time?

The timestamp is time-zone independent; the display is not. 1700000000 renders as 22:13 UTC on 14 November 2023, but as 19:13 in São Paulo and 23:13 in Madrid. That is the same instant, not a conversion error. Store timestamps in UTC (or as an integer) and apply the user's zone only when formatting. ISO 8601 strings such as 2023-11-14T22:13:20Z make the zone explicit and are easier to read in logs.

What About the 2038 Problem and Leap Seconds?

Two classic traps remain. Unix time ignores leap seconds: every day is treated as exactly 86,400 seconds, so the counter can drift by a second from UTC after a leap second is inserted. The 2038 problem is an overflow: systems that store the value in a signed 32-bit integer run out at 2147483647, which is 2038-01-19T03:14:07Z, and wrap back to 1901. Use 64-bit integers or ISO 8601 strings in new schemas, and check that embedded devices and older databases can survive that date.

How Do You Convert Timestamps Without Mistakes?

Decide the unit before you write the value, keep raw timestamps in UTC, and convert only at the edges of the system. A converter is handy for checking a suspicious number: paste it and see the date, the unit, and the ISO string side by side. Use the Epoch & Timestamp Converter to convert seconds, milliseconds, and microseconds in both directions — it runs entirely in your browser.

FAQ

Related Articles