Unix Timestamp Converter

// timestamp ↔ date · seconds & milliseconds · all timezones · live clock

current unix timestamp
0
live
0 ms
timestamp → date
UTC
Local
ISO 8601
Relative
Day of week
date → timestamp
Unix (s)
Unix (ms)
ISO 8601
UTC string
quick reference — click to convert

What is a Unix timestamp?

A Unix timestamp is the number of seconds that have elapsed since January 1, 1970 00:00:00 UTC (the Unix epoch). It's a timezone-independent way to represent a moment in time, widely used in databases, APIs, and programming languages.

Seconds vs milliseconds

Unix timestamps in seconds are 10 digits long (e.g. 1700000000). Millisecond timestamps are 13 digits (e.g. 1700000000000). JavaScript's Date.now() returns milliseconds. Most databases and APIs use seconds.

Why Unix timestamps are used in programming

Unix timestamps (also called Epoch time or POSIX time) represent a moment in time as a single integer — the number of seconds elapsed since January 1, 1970 at 00:00:00 UTC. This simple representation has enormous advantages for programming: timestamps can be compared with a single subtraction, stored in a standard integer field, and are completely timezone-independent.

Date arithmetic becomes trivial with timestamps. Want to find events from the last 7 days? Subtract 604800 (7 × 24 × 60 × 60) from the current timestamp. Want to check if a JWT token has expired? Compare its exp claim to the current timestamp. Want to sort events chronologically? Sort by timestamp numerically.

The timezone-independence is crucial in global applications. If you store a timestamp as a local datetime string, you need to know which timezone it was in to interpret it correctly. A Unix timestamp always refers to a specific absolute moment in UTC, regardless of where the server or user is located.

Seconds vs milliseconds — a common source of bugs

One of the most common bugs when working with timestamps is mixing seconds and milliseconds. Unix timestamps are traditionally in seconds (10 digits, e.g. 1700000000). JavaScript's Date.now() and Java's System.currentTimeMillis() return milliseconds (13 digits, e.g. 1700000000000).

Passing milliseconds to a function expecting seconds results in a date 1000 times in the future (around the year 55000). Passing seconds to a function expecting milliseconds results in a date in early 1970. Always check which unit your function expects. This tool automatically detects whether you've pasted a seconds or milliseconds timestamp based on the number of digits.

Frequently Asked Questions

What is the Unix epoch?+
The Unix epoch is January 1, 1970, 00:00:00 UTC — the reference point from which Unix timestamps are counted. This date was chosen somewhat arbitrarily when Unix was being developed in the late 1960s.
What is the Year 2038 problem?+
32-bit systems store Unix timestamps as a signed 32-bit integer, which maxes out at 2,147,483,647 — corresponding to January 19, 2038. After that, the counter overflows to a negative number. Modern 64-bit systems don't have this problem.
How do I get the current timestamp in code?+
JavaScript: Math.floor(Date.now()/1000) (seconds) or Date.now() (ms). Python: import time; time.time(). PHP: time(). SQL: UNIX_TIMESTAMP() (MySQL) or EXTRACT(EPOCH FROM NOW()) (PostgreSQL).