Unix Timestamp Converter

Convert Unix timestamps to human-readable dates and back. Supports seconds and milliseconds, ISO 8601, RFC 2822, relative time, and code snippets.

About the Unix Timestamp Converter

Unix time (also called Epoch time or POSIX time) counts the seconds that have elapsed since January 1, 1970 00:00:00 UTC — a date known as the Unix Epoch. Nearly every computer system, database, API, and programming language uses Unix timestamps internally, making this the universal language of time in computing. Log files, JSON Web Tokens, database records, and HTTP cache headers all speak Unix time.

This converter translates between Unix timestamps and human-readable dates, supporting both seconds and milliseconds (JavaScript's Date.now() format). It outputs ISO 8601, RFC 2822, and relative time formats, shows a visual position on the 1970–2038 epoch timeline, and includes a notable-milestones table and code snippets for eight programming languages.

Whether you're debugging an API that returns epoch milliseconds, parsing log timestamps, setting cookie expiration, or preparing for the Y2038 problem (when signed 32-bit timestamps overflow), this tool gives you instant, multi-format conversion with developer context.

Why Use This Unix Timestamp Converter?

Every developer encounters Unix timestamps — in API responses, database columns, JWT expiry fields, and server logs. This tool converts instantly, shows both seconds and milliseconds, outputs copy-ready formats (ISO 8601 / RFC 2822), and includes code snippets for 8 languages. Keep these notes focused on your operational context. Tie the context to the calculator’s intended domain.

How to Use This Calculator

  1. Choose the conversion direction: Unix timestamp → Date, or Date → Unix timestamp.
  2. If converting from a timestamp, enter the numeric value or click a preset (Epoch, Y2K, Max 32-bit, Now).
  3. Select whether your timestamp is in seconds or milliseconds.
  4. If converting from a date, enter an ISO 8601 string (e.g. 2025-03-08T12:00:00).
  5. Read the output: seconds, milliseconds, ISO 8601, RFC 2822, day/week of year, and relative time.
  6. Check the epoch timeline bar to see where your timestamp falls between 1970 and 2038.
  7. Copy code snippets for getting the current timestamp in your programming language.

Formula

Unix timestamp = number of seconds since 1970-01-01 00:00:00 UTC Milliseconds = Unix seconds × 1000 Max 32-bit signed integer = 2,147,483,647 (2038-01-19 03:14:07 UTC) Date → Unix: Math.floor(Date.parse(dateString) / 1000) Unix → Date: new Date(unixSeconds * 1000)

Example Calculation

Result: 2021-01-01T00:00:00Z

Timestamp 1,609,459,200 seconds since epoch equals midnight UTC on January 1, 2021 — the start of the year.

Tips & Best Practices

The Y2038 Problem Explained

The signed 32-bit integer maximum is 2,147,483,647, which corresponds to 2038-01-19 03:14:07 UTC. After this moment, 32-bit systems that store time as a signed int32 will overflow — wrapping to −2,147,483,648, which represents December 13, 1901. This is analogous to the Y2K bug but affects embedded systems, IoT devices, and legacy databases.

Modern Linux kernels (5.6+), macOS, Windows, and 64-bit programming languages already use 64-bit timestamps. The risk is concentrated in embedded firmware, old databases, and file formats with fixed 32-bit fields (like some ext3 filesystems and certain NTP implementations).

Common Timestamp Formats

| Format | Example | Usage | |---|---|---| | Unix seconds | 1609459200 | APIs, databases, JWT | | Unix milliseconds | 1609459200000 | JavaScript, Java | | ISO 8601 | 2021-01-01T00:00:00Z | JSON, XML, logs | | RFC 2822 | Fri, 01 Jan 2021 00:00:00 +0000 | Email, HTTP headers |

Debugging Timestamps

When an API returns a timestamp and you are unsure of the unit: if the number is around 1.7 billion, it is seconds; around 1.7 trillion, milliseconds; around 1.7 quadrillion, microseconds (used by PostgreSQL and some scientific systems). Timestamps near 0 might indicate a bug — many systems default to epoch when parsing fails.

Frequently Asked Questions

What is Unix time?

Unix time counts seconds since January 1, 1970 00:00:00 UTC (the Unix Epoch). It ignores leap seconds and provides a simple linear count of time.

What is the Y2038 problem?

On January 19, 2038 at 03:14:07 UTC, a signed 32-bit integer will overflow (2,147,483,647). Systems using 32-bit time_t will wrap to negative values, interpreting time as 1901. Most modern systems use 64-bit timestamps.

Why does JavaScript use milliseconds?

Date.now() and Date.getTime() return milliseconds since epoch for sub-second precision. Divide by 1000 to get standard Unix seconds.

Does Unix time handle leap seconds?

No. Unix time assumes every day has exactly 86,400 seconds. During a leap second, the Unix timestamp either repeats or smears the extra second — behavior varies by system.

How do I store timestamps in a database?

Use INTEGER (Unix seconds) for simplicity and timezone neutrality, or TIMESTAMP/DATETIME for readability. Always store in UTC and convert to local time on display.

What is epoch 0?

Timestamp 0 corresponds to 1970-01-01 00:00:00 UTC. Negative values represent dates before the epoch (e.g., -86400 = 1969-12-31).

Related Pages