Glossary

Unix timestamp

A Unix timestamp (also called Unix time or epoch time) is the number of seconds that have elapsed since the Unix epoch, 1970-01-01T00:00:00 UTC, ignoring leap seconds. It's the standard way computers represent an absolute point in time internally, precisely because it's just one number, unambiguous across time zones — converting it to a human-readable date is a display-time concern, not a storage concern.

How it works

Time before the epoch is represented as a negative number; time after is positive and increases by exactly 1 per second:

0            → 1970-01-01T00:00:00Z
1700000000   → 2023-11-14T22:13:20Z
1900000000   → 2030-03-17T17:46:40Z

Many APIs and languages (notably JavaScript's Date.now()) return milliseconds since the epoch instead of seconds — a frequent source of "date is 50 years off" bugs when a value is fed to a library expecting the other unit. Because leap seconds aren't counted, Unix time isn't a perfectly linear measure of elapsed physical time, but for nearly all software purposes (sorting, scheduling, storage) that distinction doesn't matter.

Common pitfalls

  • Mixing up seconds and milliseconds since epoch is the single most common Unix-timestamp bug — a millisecond value fed to a seconds-expecting function lands in the year 1970-something-large, not the intended date.
  • Classic Unix time was stored as a 32-bit signed integer, which overflows at 2^31 − 1 seconds after the epoch — 2038-01-19 03:14:07 UTC, the "Year 2038 problem." Modern systems use 64-bit storage, but old software and file formats can still be affected.
  • A Unix timestamp has no time zone — it's always UTC by definition. Any "local time" shown to a user is a conversion, and getting that conversion wrong (or skipping it) is a common display bug, not a storage bug.
  • Dates before 1970 are valid as negative timestamps, but not every library or database column supports them.

Related terms

  • ISO 8601 — the human-readable string format Unix timestamps are usually converted to for display or logging.
  • UTC — the time zone a Unix timestamp is implicitly always expressed in.
  • UUID — version 1 and version 7 UUIDs embed a timestamp (in different units and epochs) in their high bits.

See also

  • Tool: JS Intl.DateTimeFormat Playground — see how a given date and time renders as formatted, time-zone-aware strings using the browser's built-in date formatting.