G
Great Online Apps
Unix Timestamp Converter: Epoch Time to Date and Back

Unix Timestamp Converter: Epoch Time to Date and Back

Convert Unix timestamps to readable dates and back with our free epoch converter. Learn how Unix time works, seconds vs. milliseconds and the 2038 problem.

A Unix timestamp is the number of seconds that have passed since 00:00:00 UTC on January 1, 1970. To convert one to a date, divide it by 86,400 to get whole days since 1970, then turn the remainder into hours, minutes and seconds. The timestamp 1700000000 is 19,675 days and 80,000 seconds after the epoch: Tuesday, November 14, 2023 at 22:13:20 UTC.

Our free Unix timestamp converter does this both ways. Type a timestamp to see the date in five formats, or pick a date and time to get its timestamp. This guide explains how Unix time works, how to convert it by hand, and the mistakes that trip people up most often.

What is Unix time?

Unix time, also called epoch time or POSIX time, counts seconds from a fixed starting point, the Unix epoch: midnight UTC on January 1, 1970. Every day counts as exactly 86,400 seconds, so leap seconds are ignored. Dates before 1970 are negative numbers: −86400 is December 31, 1969.

Programmers use it because a single number is easy to store, sort and compare. It carries no time zone, so a server in Tokyo and one in Chicago record the same moment with the same value. You will find Unix timestamps in databases, log files, API responses, JSON Web Tokens and file metadata.

How to convert a Unix timestamp to a date by hand

Worked example: 1700000000

  1. Whole days. 1,700,000,000 ÷ 86,400 = 19,675.93, so 19,675 full days have passed since the epoch.
  2. Seconds left over. 19,675 × 86,400 = 1,699,920,000, which leaves 80,000 seconds.
  3. Time of day. 80,000 ÷ 3,600 = 22 hours, with 800 seconds left. 800 seconds is 13 minutes and 20 seconds. The time is 22:13:20.
  4. Date. Counting 19,675 days forward from January 1, 1970 lands on November 14, 2023.

The last step is where hand calculation gets slow, because you have to step through years of different lengths. A converter handles leap years and month lengths for you.

Seconds or milliseconds?

Standard Unix time is in seconds, which is 10 digits for any date between 2001 and 2286. JavaScript's Date.now(), Java and many APIs return milliseconds instead, a 13-digit number such as 1700000000000. Divide by 1,000, or drop the last three digits, before converting.

The converter works in seconds and accepts values from year 1 to the end of year 9999. A 13-digit millisecond value is far beyond that range, so the converter shows an error and leaves the formats blank instead of returning a wrong date.

Notable Unix timestamps

Timestamp Date and time (UTC) Why it matters
0 Thu, 1 Jan 1970 00:00:00 The Unix epoch
86,400 Fri, 2 Jan 1970 00:00:00 Exactly one day
1,000,000,000 Sun, 9 Sep 2001 01:46:40 The first 10-digit timestamp
1,700,000,000 Tue, 14 Nov 2023 22:13:20 The worked example above
1,800,000,000 Fri, 15 Jan 2027 08:00:00 The next round hundred million
2,147,483,647 Tue, 19 Jan 2038 03:14:07 The largest signed 32-bit value

The year 2038 problem

Systems that store Unix time in a signed 32-bit integer run out of room at 03:14:07 UTC on January 19, 2038. One second later the value overflows and wraps to a date in December 1901. Most modern systems use 64-bit integers, which push the limit billions of years away, but old embedded devices and file formats can still be affected.

What each output format is for

The converter shows the same moment in five formats, each with a copy button. For 1700000000 they read:

  • RFC 2822: Tue, 14 Nov 2023 22:13:20 +0000, the style used in email headers.
  • Atom: 2023-11-14T22:13:20+00:00, used in Atom and RSS feeds.
  • ISO 8601: 2023-11-14T22:13:20+00:00, the standard for APIs and JSON. In UTC it is the same string as the Atom format.
  • Relative: how long ago or how far ahead the moment is, such as "2 years ago".
  • UTC: 2023-11-14 22:13:20 UTC, a plain format that reads well in logs and spreadsheets.

How to use the timestamp converter

  1. Open the timestamp converter. It starts at the current time.
  2. To convert a timestamp to a date, type it into Unix timestamp, in seconds. Negative values work for dates before 1970.
  3. To convert a date to a timestamp, set Date and time, down to the second. The date and time are in UTC, and editing either field updates the other.
  4. Copy the format you need with the button beside it.
  5. Press Reset to now to return to the current moment.

Tips for working with timestamps

  • Convert to local time last. A timestamp is always UTC. Read it as UTC first, then use the time zone converter to see the same moment in New York, London or Tokyo.
  • Subtract to measure time. The difference between two timestamps is the elapsed time in seconds. Divide by 3,600 for hours or 86,400 for days. For calendar spans in months and days, the date difference calculator is easier.
  • Check the digit count. Ten digits means seconds, 13 means milliseconds and 16 means microseconds.
  • Get the current timestamp in code. Use date +%s in a Unix shell, Math.floor(Date.now() / 1000) in JavaScript, time() in PHP or int(time.time()) in Python.

Frequently asked questions

What is a Unix timestamp?

It is the number of seconds since 00:00:00 UTC on January 1, 1970, not counting leap seconds. For example, 1700000000 is November 14, 2023 at 22:13:20 UTC.

How do I convert a Unix timestamp to a date?

Paste it into a Unix timestamp converter, or divide it by 86,400 to get days since January 1, 1970 and convert the remainder into hours, minutes and seconds. The result is in UTC.

Is a Unix timestamp in seconds or milliseconds?

Standard Unix time is in seconds, which is 10 digits for current dates. JavaScript and many APIs use milliseconds, which is 13 digits. Divide a millisecond value by 1,000 before converting it as seconds.

Do Unix timestamps depend on time zones?

No. A timestamp marks one moment for the whole world. Time zones only matter when you display it as a local date and time, which is why converters show the result in UTC.

What happens to Unix time in 2038?

Signed 32-bit timestamps reach their maximum, 2,147,483,647, at 03:14:07 UTC on January 19, 2038, and then overflow. Systems that store time in 64-bit integers are not affected.

Can a Unix timestamp be negative?

Yes. Negative values count back from the epoch, so −86400 is December 31, 1969. The converter accepts negative timestamps back to January 1 of year 1.

Ready to use this tool?

Try the Timestamp Converter now and simplify your workflow immediately.

G
Great Online Apps
Toggle sidebar