Skip to content
M2TOOLKIT
Developer Resources

What Is a Unix Timestamp? Epoch Time Explained

What Unix time is, why it starts in 1970, how to tell seconds from milliseconds, how time zones fit in, and how to convert timestamps in common languages.

By Published 6 min read

Hand holding a pocket stopwatch
Photo: Veri Ivanova on StockSnap (CC0 1.0)

Quick answer

A Unix timestamp is the number of seconds since 00:00:00 UTC on January 1, 1970 (the “Unix epoch”), not counting leap seconds. For example, 1767225600 is midnight UTC on January 1, 2026. Many systems, including JavaScript, use milliseconds instead, so a 13-digit number is usually milliseconds.

Timestamps show up in logs, databases, APIs, JWTs and cookies. They're popular because a single number is easy to store, compare and sort, and it means the same instant everywhere in the world, whatever the local time zone.

In this article
  1. Why 1970?
  2. Seconds, milliseconds, microseconds
  3. Timestamps and time zones
  4. Converting in code
  5. The year 2038 problem

Why 1970?

Unix was developed at Bell Labs around 1969–1971, and its designers needed a recent, round starting point for the system clock. January 1, 1970 was simply convenient. Dates before 1970 are written as negative numbers.

Seconds, milliseconds, microseconds

The quickest way to tell units apart is the number of digits (for dates in this era):

DigitsUnitExampleUsed by
10Seconds1767225600Unix, PHP, Python time.time(), JWT
13Milliseconds1767225600000JavaScript Date.now(), Java
16Microseconds1767225600000000PostgreSQL, some logs
19Nanoseconds1767225600000000000Go, high-precision systems
Try the free Unix Timestamp ConverterPaste any timestamp — the unit is detected and the date shown in UTC and your local time.

Timestamps and time zones

A timestamp has no time zone: it identifies one instant for the whole planet. Time zones only matter when you display it. 1767225600 is midnight in London but 7:00 PM on December 31 in New York.

Alarm clock on a table
Alarm clock on a tablePhoto: Negative Space on StockSnap (CC0 1.0)

Converting in code

LanguageCurrent timestamp (s)Timestamp → date
JavaScriptMath.floor(Date.now() / 1000)new Date(ts * 1000)
Pythonint(time.time())datetime.fromtimestamp(ts, timezone.utc)
PHPtime()date("c", $ts)
SQL (PostgreSQL)extract(epoch from now())to_timestamp(ts)
Bashdate +%sdate -d @ts

The year 2038 problem

Systems that store timestamps as signed 32-bit integers can count only up to 2,147,483,647 — which is 03:14:07 UTC on January 19, 2038. After that, the number wraps to a negative value. Modern systems use 64-bit timestamps, which last for billions of years, but old embedded devices and databases may still need updating.

Frequently asked questions

Do Unix timestamps include leap seconds?

No. Unix time pretends every day has exactly 86,400 seconds, which keeps the math simple. Leap seconds are absorbed by the clock adjusting slightly.

What timestamp is it right now?

The Unix Timestamp Converter shows the current timestamp, updating every second.

M2Toolkit Editorial Team

The people who build M2Toolkit's tools write these guides. Every formula and example in an article is checked against the matching tool, and articles are reviewed when the tool changes.

All articles →

Free tools for this