Guide

What is epoch time?

Epoch time, also called Unix time, POSIX time or a Unix timestamp, is the number of seconds that have passed since 00:00:00 UTC on 1 January 1970, not counting leap seconds. That moment is the Unix epoch.

Current epoch time in seconds

1790660338

In milliseconds

1790660338000

Because it is a single number with no time zone, epoch time is how logs, databases, APIs and file systems store moments in time. It is compact, sorts correctly and means the same thing everywhere. The catch is that people can't read it, so 1790561638 needs converting before you know it means 28 September 2026, 02:13:58 UTC.

Epoch time in seconds or milliseconds

Classic Unix time counts seconds, but many systems count milliseconds instead, including JavaScript'sDate.now() and Java's System.currentTimeMillis(). You can usually tell them apart by length:

  • 10 digits is seconds, like 1790561638.
  • 13 digits is milliseconds, like 1790561638000.
  • 16 digits is microseconds and 19 digits is nanoseconds.

To go from milliseconds to seconds, divide by 1,000. To go the other way, multiply by 1,000.

Is epoch time always UTC?

Yes. An epoch timestamp has no time zone: it counts from midnight UTC, so the same number is the same instant everywhere. Time zones only come in when you convert it to a readable date, which is why the same timestamp reads 02:13 in UTC and 21:13 the previous evening in Chicago.

How to convert epoch time to a date

Each of these turns 1790561638 into a date. For a 13-digit millisecond timestamp, divide it by 1,000 first, except in JavaScript, where new Date() takes milliseconds as is.

JavaScript

new Date(1790561638 * 1000).toISOString()
// "2026-09-28T02:13:58.000Z"

Python

from datetime import datetime, timezone
datetime.fromtimestamp(1790561638, tz=timezone.utc)
# 2026-09-28 02:13:58+00:00

Terminal (macOS)

date -u -r 1790561638
# Mon Sep 28 02:13:58 UTC 2026

Terminal (Linux)

date -u -d @1790561638
# Mon Sep 28 02:13:58 UTC 2026

PostgreSQL

SELECT to_timestamp(1790561638);

MySQL

SELECT FROM_UNIXTIME(1790561638);

Excel or Google Sheets

=A1/86400 + DATE(1970,1,1)
' then format the cell as a date and time

How to convert a date to epoch time

And these go the other way, from 28 September 2026, 02:13:58 UTC back to 1790561638.

JavaScript

Math.floor(Date.parse("2026-09-28T02:13:58Z") / 1000)
// 1790561638

Python

from datetime import datetime, timezone
int(datetime(2026, 9, 28, 2, 13, 58, tzinfo=timezone.utc).timestamp())
# 1790561638

Terminal (macOS)

date -j -u -f "%Y-%m-%d %H:%M:%S" "2026-09-28 02:13:58" +%s
# 1790561638

Terminal (Linux)

date -u -d "2026-09-28 02:13:58" +%s
# 1790561638

How to get the current epoch time

JavaScript

Math.floor(Date.now() / 1000)  // seconds
Date.now()                     // milliseconds

Python

import time
int(time.time())               # seconds
time.time_ns() // 1_000_000    # milliseconds

Terminal

date +%s

The year 2038 problem

Systems that store epoch time as a signed 32-bit integer run out of room at 2147483647, which is 03:14:07 UTC on 19 January 2038. One second later the number wraps around to a date in 1901. Modern operating systems and languages use 64-bit timestamps, which won't overflow for billions of years, but old embedded systems and file formats still need checking.

An epoch converter on your Mac

If you convert timestamps often, Epocher keeps an epoch converter in your Mac's menu bar. Paste a Unix timestamp to see it in local time, UTC and ISO 8601, or pick a date to get its epoch time. It detects seconds and milliseconds on its own and keeps a history of what you copy. It's free.

Download on the Mac App Store