Unix Timestamp — Epoch Time Explained

Unix timestamps are used everywhere in programming — databases, APIs, logs, JWTs. But what exactly is a Unix timestamp, why does it start at 1970, and how do you convert one to a readable date?

Free Online Unix Timestamp Converter

Convert Unix timestamps to human-readable dates and back. Supports seconds, milliseconds, and multiple timezones.

Open Unix Timestamp Converter →

What is a Unix timestamp?

A Unix timestamp (also called epoch time or POSIX time) is the number of seconds that have elapsed since January 1, 1970, at 00:00:00 UTC. This reference point is called the Unix epoch.

Example
Unix timestamp:  1704067200
Human readable:  Monday, January 1, 2024, 00:00:00 UTC

The current Unix timestamp is always a large integer — around 1.7 billion for dates in 2024. It's a universal, timezone-independent way to represent a moment in time.

Why does Unix time start in 1970?

The Unix operating system was developed in the late 1960s and early 1970s at Bell Labs. When the developers needed to choose a starting point for their time system, they picked January 1, 1970 — a round number that was recent enough to be practical. It was an arbitrary but convenient choice that became the global standard.

Seconds vs milliseconds

You'll encounter two common formats:

FormatExamplePrecisionCommon in
Seconds17040672001 secondUnix/Linux, databases, JWT (exp claim)
Milliseconds17040672000001 millisecondJavaScript (Date.now()), Java, most APIs

A quick way to tell them apart: if the number is 13 digits, it's milliseconds. If it's 10 digits, it's seconds. The timestamp converter handles both automatically.

How to get the current Unix timestamp in code

JavaScript
// Seconds
Math.floor(Date.now() / 1000)

// Milliseconds
Date.now()
Python
import time

# Seconds
int(time.time())

# Milliseconds
int(time.time() * 1000)
SQL (PostgreSQL)
-- Current timestamp in seconds
SELECT EXTRACT(EPOCH FROM NOW())::INT;

-- Convert timestamp to date
SELECT TO_TIMESTAMP(1704067200);
SQL (MySQL)
-- Current Unix timestamp
SELECT UNIX_TIMESTAMP();

-- Convert to datetime
SELECT FROM_UNIXTIME(1704067200);

How to convert a Unix timestamp online

Paste any Unix timestamp (seconds or milliseconds) into the tinybench.dev timestamp converter to get the human-readable date and time in UTC and your local timezone. You can also convert in the other direction — enter a date and get the Unix timestamp back.

The Year 2038 problem

32-bit systems store Unix timestamps as a signed 32-bit integer, which has a maximum value of 2,147,483,647 — representing January 19, 2038, at 03:14:07 UTC. After this point, 32-bit systems will overflow and wrap around to a negative number (representing 1901).

Most modern systems use 64-bit timestamps, which won't overflow for approximately 292 billion years. The 2038 problem is mainly a concern for legacy embedded systems and old databases still using 32-bit storage.

Frequently asked questions

Is Unix time affected by timezones?
No. A Unix timestamp always represents a moment in UTC, regardless of where in the world you are. This makes it ideal for storing times in databases — you store the UTC timestamp and convert to local time on display.
Does Unix time account for leap seconds?
No. Unix time assumes exactly 86,400 seconds per day. Leap seconds (which are occasionally added to keep UTC in sync with Earth's rotation) are not counted. This means Unix time is technically not perfectly synchronised with UTC, but the difference is negligible for most applications.
Why are JWT expiry times stored as Unix timestamps?
The exp claim in a JWT is a Unix timestamp (seconds since epoch) because it's compact, timezone-independent, and easy to compare against the current time with a simple integer comparison.

Try it now — free & private

Runs entirely in your browser. No sign-up, no uploads, no tracking.

Open Unix Timestamp Converter →

Related tools on tinybench.dev