Unix Timestamp Converter

Paste an epoch in seconds, milliseconds, microseconds or nanoseconds to see the date, or pick a date and time zone to get its epoch.

Current Unix timestamp (seconds)
In milliseconds

Timestamp to date

Unit

Date to timestamp

How to use it

  1. The current Unix time runs at the top. Press Copy to copy the seconds or milliseconds value.
  2. Paste a timestamp into Unix timestamp. The unit is guessed from the length of the number; pick the unit yourself if the guess is wrong.
  3. Read the result as local time, UTC, ISO 8601, RFC 2822 and relative time, and copy the line you need.
  4. For the other direction, enter a date and time, choose the time zone, then copy the epoch in seconds or milliseconds.

What a Unix timestamp is

A Unix timestamp, often just called epoch time, is the number of seconds since 1 January 1970 at 00:00:00 UTC. The value 1700000000 is 14 November 2023 at 22:13:20 UTC, which was 5:13:20 PM the same day in New York. Because it counts from UTC, the same number means the same moment everywhere; only the way it is displayed changes. Leap seconds are not counted, so every day in Unix time is exactly 86,400 seconds long. Moments before 1970 are negative: -86400 is 31 December 1969 at 00:00 UTC.

How the unit is detected

Many systems store epochs in milliseconds or finer units. This tool guesses from the size of the number: below 1011 it reads seconds, below 1014 milliseconds, below 1017 microseconds, and anything larger nanoseconds. So a 10-digit number is read as seconds and a 13-digit one as milliseconds. With these limits, every unit other than seconds is read as a date between 3 March 1973 and 16 November 5138. For milliseconds before March 1973, pick the unit yourself. A 19-digit nanosecond value is more precise than an ordinary JavaScript number can hold, so the math uses BigInt and no digit is rounded away.

The year 2038 problem

Many older systems store the epoch as a signed 32-bit integer, whose largest value is 2,147,483,647. That falls on 19 January 2038 at 03:14:07 UTC. One second later the counter overflows to -2,147,483,648, which reads as 13 December 1901 at 20:45:52 UTC. 64-bit systems are not affected, but the old limit survives in many places: MySQL's TIMESTAMP column type, for example, only goes up to 2038-01-19 03:14:07 UTC. Type 2147483647 and then 2147483648 above to see the last second and the one after it.

Seconds or milliseconds in common languages

LanguageCurrent timeUnit
JavaScriptDate.now()milliseconds
Pythontime.time(), time.time_ns()seconds (float), nanoseconds (Python 3.7+)
PHPtime(), microtime(true)seconds, seconds (float)
JavaSystem.currentTimeMillis(), Instant.now().getEpochSecond()milliseconds, seconds
Gotime.Now().Unix(), UnixMilli(), UnixNano()seconds, milliseconds (Go 1.17+), nanoseconds
SQLMySQL UNIX_TIMESTAMP(), PostgreSQL EXTRACT(EPOCH FROM now())seconds

The most common bug is mixing the two. Sending Date.now() to an API that expects seconds produces a date around the year 58,000, while seconds read as milliseconds land in January 1970.

Questions

How do I convert a timestamp to a date in Excel or Google Sheets?
For an epoch in seconds in cell A1, use =A1/86400+DATE(1970,1,1) and format the cell as date and time. The result is in UTC; add or subtract your offset as a fraction of a day, for example -5/24 for US Eastern standard time. For milliseconds, divide by 86400000 instead.
Why is the time in my result off by a few hours?
An epoch always counts from UTC. A system that shows the result in UTC will be 5 hours ahead of New York in winter, or 1 hour behind London in summer. Look at the local time line for the time in your device's zone.
Does a Unix timestamp depend on the time zone?
No. One timestamp points at the same instant everywhere in the world. The time zone only matters when the number is shown as a date, or when a date is turned into a timestamp. That is why the Date to timestamp section asks for a zone.
Why does my date show up as 1970, or tens of thousands of years from now?
The units are mixed up. Seconds read as milliseconds fall in January 1970, and milliseconds read as seconds fall tens of thousands of years ahead. Pick the right unit above, or divide or multiply by 1000 in your code.
What happens with daylight saving time?
If the time you pick never happened because the clocks went forward (2:30 AM on the spring-forward night in most of the US), or happened twice because they went back, the tool says so and explains which moment it used.
How far can timestamps go here?
To the limits of a JavaScript date: 100 million days either side of 1970, that is the years -271821 to 275760. 64-bit systems never reach their limit in practice; 32-bit systems stop at 19 January 2038.