Unix timestamp to date converter

Convert a Unix timestamp to a readable date and time — or any date back to a Unix timestamp. Supports seconds and milliseconds.

Current Unix timestamp

Timestamp → Date

UTC
Local time
ISO 8601
Relative

Date → Timestamp

Seconds (s)
Milliseconds (ms)

What is a Unix timestamp?

A Unix timestamp, also called Unix time or POSIX time, is the number of seconds that have elapsed since 1970-01-01 00:00:00 UTC, known as the Unix epoch. It is a widely used standard in computing because it represents a point in time as a single integer, which makes storage, comparison, and arithmetic straightforward.

JavaScript works internally in milliseconds, so Date.now() returns the Unix timestamp multiplied by 1000. Many APIs, databases, and backend systems use seconds instead. This tool accepts either format and detects seconds or milliseconds automatically based on the size of the number you enter.

Notable Unix timestamps

TimestampDate (UTC)Note
01970-01-01 00:00:00Unix epoch
1,000,000,0002001-09-09 01:46:401 billion seconds
2,000,000,0002033-05-18 03:33:202 billion seconds
2,147,483,6472038-01-19 03:14:07Year 2038 problem (max 32-bit)

Why 1970?

The Unix epoch of January 1, 1970 was chosen partly by convention and partly by practical constraints. Unix was developed in the late 1960s and early 1970s at Bell Labs. The developers needed a recent, round starting date for their time representation. January 1, 1970 was recent enough to be practical and had no special technical significance — it was simply a convenient anchor point.

Alternative epoch dates exist in other systems: the Windows FILETIME epoch is January 1, 1601; GPS time started January 6, 1980; the NTP epoch is January 1, 1900. When converting between systems, knowing each system's epoch is essential.

Seconds vs milliseconds

The original Unix timestamp is in seconds. Most server-side languages and systems (Unix shell, Python's time.time(), PHP's time(), most databases) use seconds. JavaScript's Date.now() and new Date().getTime() return milliseconds. This mismatch is a common source of bugs when JavaScript frontends communicate with backend APIs.

A Unix timestamp in seconds is currently a 10-digit number (around 1,700,000,000 as of 2023). A millisecond timestamp is a 13-digit number. The calculator detects which format you have entered based on the number of digits and converts accordingly.

The Year 2038 problem

Systems that store Unix timestamps as a signed 32-bit integer can only represent dates up to 2,147,483,647 seconds after the epoch — which is 03:14:07 UTC on January 19, 2038. After that moment, a 32-bit signed integer overflows to a large negative number, representing a date in 1901.

This is sometimes called the "Y2K38" problem or the Unix Millennium Bug. Modern 64-bit systems are not affected, as a signed 64-bit integer can represent timestamps for approximately 292 billion years. However, embedded systems, legacy databases, and older 32-bit software may still be vulnerable. Many industries — including telecommunications, banking, and industrial control systems — have ongoing migration efforts to address this.

How to get the current Unix timestamp

Language / environmentCommand
JavaScriptMath.floor(Date.now() / 1000)
Pythonimport time; int(time.time())
PHPtime()
Bashdate +%s
SQL (PostgreSQL)EXTRACT(EPOCH FROM NOW())::int
SQL (MySQL)UNIX_TIMESTAMP()
Gotime.Now().Unix()
RustSystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs()

Practical uses

API development: REST APIs commonly use Unix timestamps for created_at, updated_at, and token expiry fields. A timestamp is timezone-agnostic and unambiguous — unlike formatted date strings, which depend on locale and formatting conventions.

Token expiry: JWT (JSON Web Tokens) use Unix timestamps for the exp (expiry) and iat (issued at) claims. A token expires when the current timestamp exceeds the exp value. Calculating expiry times — "this token should expire in 24 hours" — requires adding 86,400 seconds to the current timestamp.

Cache TTL: Cache expiry is often set as a Unix timestamp or as a number of seconds from now. Debugging cache issues frequently requires converting a stored expiry timestamp to a human-readable date.

Log analysis: Server logs often include Unix timestamps. Converting them to readable dates is the first step in correlating log entries with real-world events.

Database storage: Storing timestamps as integers rather than formatted strings avoids timezone conversion bugs and simplifies sorting, range queries, and arithmetic. A query for "all records from the last 7 days" becomes WHERE created_at > (NOW_UNIX - 604800).

Frequently asked questions

What is a Unix timestamp?

A Unix timestamp is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC — a reference point called the Unix epoch. It represents any point in time as a single integer, which makes it easy to store, compare, and do arithmetic with. It is the standard time format used in most operating systems, databases, APIs, and programming languages.

How do I convert a Unix timestamp to a date?

Enter the timestamp into the converter and it returns the corresponding date and time in UTC and your local timezone. The tool automatically detects whether you have entered seconds (a 10-digit number) or milliseconds (a 13-digit number). You can also convert in the other direction: select a date and time to get the corresponding Unix timestamp.

What is the difference between Unix time in seconds and milliseconds?

The original Unix timestamp is in seconds. Most server-side systems — PHP, Python, Go, Bash, SQL databases — use seconds. JavaScript's Date.now() and new Date().getTime() return milliseconds (Unix seconds × 1000). A seconds timestamp is currently 10 digits; a milliseconds timestamp is 13 digits. Confusing the two is a common bug when a JavaScript frontend sends a timestamp to a backend that expects seconds.

Why does Unix time start on January 1, 1970?

The date was chosen by the developers of Unix at Bell Labs in the early 1970s as a convenient recent starting point. It has no special significance beyond being a round date close to when the system was developed. Other systems use different epochs: Windows FILETIME starts January 1, 1601; GPS time starts January 6, 1980; NTP starts January 1, 1900.

What is the Year 2038 problem?

Systems that store Unix timestamps as a signed 32-bit integer can only represent dates up to January 19, 2038 (timestamp 2,147,483,647). After that, the value overflows to a large negative number, representing a date in 1901. Modern 64-bit systems are not affected. However, legacy embedded systems, older databases, and 32-bit software may still be vulnerable and require migration before that date.

How do I get the current Unix timestamp in my programming language?

JavaScript: Math.floor(Date.now() / 1000). Python: import time; int(time.time()). PHP: time(). Bash: date +%s. PostgreSQL: EXTRACT(EPOCH FROM NOW())::int. MySQL: UNIX_TIMESTAMP(). Go: time.Now().Unix(). These all return the current time as seconds since the Unix epoch.