Developer Tools

Unix Timestamp (Epoch Time) Explained — How to Convert

PAYATE Team· · 5 min read
Unix Timestamp (Epoch Time) Explained — How to Convert

If you have ever seen a number like 1735689600 where you expected a date, you have met a Unix timestamp. It is how most computers, databases, APIs and log files store time under the hood. This guide explains what epoch time is, why it exists, the famous "Year 2038 problem," and how to convert a timestamp to a human date (and back).

What a Unix timestamp is

A Unix timestamp — also called epoch time, POSIX time or Unix time — is simply the number of seconds that have elapsed since 00:00:00 UTC on 1 January 1970, not counting leap seconds. That starting moment is called the Unix epoch.

So 0 is midnight on 1 Jan 1970 (UTC), 86400 is exactly one day later, and 1735689600 is 1 January 2025. Because it is one single counting number, it is easy to store, compare and do maths with.

Want to see it live? Our Epoch / Unix Timestamp Converter turns any timestamp into a readable date and any date into a timestamp instantly.

Why computers use epoch time instead of dates

Storing "14 March 2026, 9:30 AM, Cairo time" is messy — it mixes a calendar, a clock and a timezone, in a human language. A timestamp sidesteps all of that:

  • It is unambiguous. One number means one exact instant worldwide, with no timezone confusion.
  • It is easy to compare. "Which event is newer?" becomes a simple "which number is bigger?"
  • It is easy to do maths on. "How long between these two events?" is just a subtraction.
  • It is compact. One integer takes far less space than a formatted date string.

That is why you will find timestamps in databases, JWTs, cookies, API responses, server logs and file metadata everywhere.

Seconds, milliseconds and other precisions

A classic gotcha: not every timestamp is in seconds. Different systems use different precision, and mixing them up is one of the most common time bugs.

UnitExampleDigits (today)Where you see it
Seconds173568960010Unix tools, databases, JWT exp
Milliseconds173568960000013JavaScript Date.now(), Java
Microseconds173568960000000016Python, high-resolution logs

Quick rule of thumb: a 10-digit number is seconds, a 13-digit number is milliseconds. If a date comes out in 1970 or thousands of years in the future, you probably mixed up the unit.

Timestamps are always UTC — timezones come later

A Unix timestamp has no timezone. It is an absolute point in time, defined in UTC. The timezone only matters when you display it: the same timestamp 1735689600 is "1 Jan 2025, 00:00 London" and "1 Jan 2025, 02:00 Cairo" — same instant, different wall clocks. This is exactly why storing time as a timestamp and converting to local time only for display avoids a whole category of bugs. To move a human time between zones, use our Timezone Converter.

Converting a timestamp to a date (and back)

The quickest way is our Epoch Converter, but here is how it works in common languages:

  • JavaScript: new Date(1735689600 * 1000) — remember JS uses milliseconds, so multiply seconds by 1000.
  • Python: datetime.utcfromtimestamp(1735689600), and int(datetime.now().timestamp()) to go back.
  • PHP: date('Y-m-d H:i:s', 1735689600), and time() or strtotime('2025-01-01') to get a timestamp.
  • SQL: most databases have FROM_UNIXTIME() / to_timestamp() functions.
  • Command line: date -d @1735689600 on Linux.

The Year 2038 problem

Older systems store the timestamp in a signed 32-bit integer, which can only count up to 2,147,483,647 seconds. That limit is reached at 03:14:07 UTC on 19 January 2038 — after which the number overflows and wraps around to a negative value, sending the date back to 1901. It is the modern echo of the Y2K bug.

The fix is already widespread: move to a 64-bit timestamp, which pushes the limit roughly 292 billion years into the future. Most current operating systems, languages and databases already use 64-bit time, but legacy embedded systems are the ones to watch.

Where you will meet timestamps as a developer

  • JWTs: the iat (issued-at) and exp (expiry) claims are Unix seconds — decode one with our JWT Decoder or read what a JWT is.
  • Cookies and caches: expiry is often stored as epoch seconds.
  • Logs: many log formats prefix each line with a timestamp.
  • APIs: created_at and updated_at fields are frequently epoch values.

Frequently asked questions

Why does the epoch start in 1970?

It is the date the engineers who built early Unix at Bell Labs chose as a convenient, recent zero point. It stuck, and it is now a standard across almost all computing.

My timestamp converts to the year 1970 — what went wrong?

You likely passed milliseconds to a function expecting seconds (or vice-versa), so the number was a thousand times too small. Check the digit count: 10 = seconds, 13 = milliseconds.

Do Unix timestamps count leap seconds?

No. Unix time deliberately ignores leap seconds and assumes every day is exactly 86,400 seconds. This keeps the maths simple, at the cost of being a tiny amount off from precise astronomical time.

Can a timestamp be negative?

Yes. Dates before 1 January 1970 are represented as negative seconds — for example, -86400 is 31 December 1969.

Is epoch time the same everywhere in the world?

Yes. A given timestamp is the same instant globally; only the local date and time you display it as changes with the timezone.

The bottom line

A Unix timestamp is just a count of seconds since 1 January 1970 UTC — a simple, timezone-free, easy-to-compare way to store an instant. Watch out for the seconds-vs-milliseconds trap and the 2038 limit on old 32-bit systems, store time as UTC and convert only for display. To convert any timestamp right now, use our Epoch / Unix Timestamp Converter, and for moving times between zones try the Timezone Converter.

Frequently asked questions

What is a Unix timestamp?
It is the number of seconds that have elapsed since 00:00:00 UTC on 1 January 1970, letting a computer store an exact moment in time as a single integer.
Why do computers use epoch time instead of dates?
A single number is timezone-free, trivial to compare and do arithmetic on, and avoids the endless ambiguity of human date formats.
What is the Year 2038 problem?
Systems that store the timestamp in a signed 32-bit integer overflow on 19 January 2038. Modern 64-bit storage removes the limit.
Is a Unix timestamp in seconds or milliseconds?
Classic Unix time is in seconds (a 10-digit value), but JavaScript and many APIs use milliseconds (a 13-digit value), so the digit count tells you which you have.

Try the tools

P
Written by PAYATE Team

The PAYATE team builds free tools for merchants and developers.

More PAYATE tools