Home โ€บ Unix Timestamp Converter (Epoch โ‡„ Date)

Unix Timestamp Converter (Epoch โ‡„ Date)

Current Unix time

โ€”

Timestamp โ†’ date

Date โ†’ timestamp

Or type any ISO 8601 date such as 2024-02-29T12:00:00Z or 2024-02-29T12:00:00+02:00:

What is a Unix timestamp?

A Unix timestamp (also called epoch time or POSIX time) is the number of seconds that have elapsed since 1970-01-01 00:00:00 UTC. It is a single integer with no time zone attached, which makes it ideal for storing and comparing moments in time: 1700000000 is the same instant everywhere on Earth โ€” it is just displayed as 22:13 UTC, 23:13 in Berlin and 17:13 in New York (on November 14, 2023).

Seconds, milliseconds and microseconds

UnitDigits todayUsed by
Seconds10Unix date +%s, PHP time(), Python int(time.time()), JWT exp/iat
Milliseconds13JavaScript Date.now(), Java System.currentTimeMillis()
Microseconds16PostgreSQL internals, Python time.time_ns()//1000

Mixing them up is the classic bug: passing seconds to JavaScript's new Date() gives a date in January 1970, and passing milliseconds to a seconds API gives a year around 55,000.

Get the current timestamp in code

JavaScript   Math.floor(Date.now() / 1000)
Python       import time; int(time.time())
Go           time.Now().Unix()
Java         Instant.now().getEpochSecond()
PHP          time()
Bash         date +%s
SQL (PG)     SELECT EXTRACT(EPOCH FROM now())::bigint;

Gotchas

Frequently asked questions

How do I know if a timestamp is in seconds or milliseconds?

Count the digits. Current Unix time in seconds has 10 digits (for example 1700000000), while milliseconds have 13 digits (1700000000000). This converter detects the unit automatically: values with an absolute value of 100,000,000,000 or more are treated as milliseconds.

What is Unix timestamp 0?

0 is the Unix epoch: 1970-01-01T00:00:00Z, midnight UTC on January 1st, 1970. Negative timestamps represent dates before 1970.

What is the Year 2038 problem?

Systems that store Unix time as a signed 32-bit integer overflow after 2147483647, which is 2038-01-19T03:14:07Z. The next second wraps to a negative number (December 1901). Modern 64-bit systems are not affected, but old databases, file formats and embedded devices may be.

Do Unix timestamps include leap seconds or time zones?

Neither. A Unix timestamp counts seconds since the epoch in UTC and ignores leap seconds, so every day is exactly 86,400 seconds. Time zones only matter when you display the timestamp as a calendar date.