Unix Epoch Converter
Convert Unix timestamps in seconds, milliseconds or nanoseconds to UTC, local and other time zones, or turn a date back into epoch time. Unit auto-detected.
The interactive tool loads here when JavaScript runs.
About this toolWhat is the Epoch Converter?
The Epoch Converter turns Unix timestamps into readable dates and readable dates back into timestamps. It detects whether a number is in seconds, milliseconds or nanoseconds, and shows the result in UTC, your local time, as a relative time ("3 hours ago") and in any additional time zones you pick.
Conversion uses the browser's Date and Intl.DateTimeFormat APIs, so time zone rules and daylight saving changes come from the same IANA database your operating system uses. The To Epoch field reads the date and time in your local zone, and after a From Epoch conversion it is filled with the same instant in local time, so converting back gives the original number.
Dates are held to the millisecond. Nanosecond timestamps are accepted, but digits below a millisecond are dropped, and the date picker works to the second.
- Automatic detection of seconds, milliseconds and nanoseconds
- UTC, local, relative and multi-time-zone output
- Date to timestamp conversion that round-trips correctly in your local zone
- Copy buttons and shareable links
- Runs locally in your browser
Updated
How to use the Epoch Converter
- On the From Epoch tab, paste a timestamp into Unix Timestamp. The unit (seconds, milliseconds or nanoseconds) is detected as you type; click Now for the current time.
- Click Convert from Epoch and read the result in UTC, local time and relative time. Add extra time zones to compare.
- On the To Epoch tab, pick a date and time (in your local zone) and click Convert to Epoch.
- Copy any value, or use the share button to copy a link to the current conversion.
Worked examples
A seconds timestamp
Input
1640995200
Output
2022-01-01 00:00:00 UTC
Ten digits, so it is read as seconds. In New York (UTC-5 in winter) the same instant is 31 December 2021, 19:00, which is why "what day was this?" depends on the zone.
The same instant in milliseconds
Input
1640995200000
Output
2022-01-01 00:00:00 UTC
Thirteen digits are read as milliseconds. Feeding this value to a function that expects seconds would put it in the year 53971.
Background and insight
Unix time counts seconds since 00:00:00 UTC on 1 January 1970, a date chosen by the early Unix developers at Bell Labs as a convenient recent round number. It ignores leap seconds, which keeps arithmetic simple: every day is exactly 86,400 seconds.
The most common bug with epoch values is a unit mismatch. Unix tools, PostgreSQL's extract(epoch ...) and JWT claims use seconds, while JavaScript's Date.now() and Java's System.currentTimeMillis() use milliseconds, and Go's time.UnixNano() and many tracing systems use nanoseconds. A 10-digit number is almost certainly seconds and a 13-digit number milliseconds. Interpret one as the other and you land in January 1970 or tens of thousands of years in the future.
Another date worth knowing is 19 January 2038. Systems that store Unix time in a signed 32-bit integer overflow at 03:14:07 UTC that day. Most modern platforms use 64-bit time, but embedded devices and old database columns are still being found and fixed.
Common use cases
Reading logs
Convert timestamps in application logs or database rows into human dates while investigating an incident.
Checking token expiry
Turn a JWT exp or iat claim into a date to see whether a token has expired.
Coordinating across time zones
See one instant in several zones at once when scheduling releases or maintenance windows.
Writing tests
Generate exact timestamps for fixtures, cron tests and date-boundary checks.
Tips and limitations
- Detection is a guess based on digits and how close each reading is to now. A seconds value from the 1970s or the far future may be read as milliseconds; check the result looks sensible.
- The Now button produces a value in the currently detected unit, so it follows whatever kind of timestamp you last typed.
- Store timestamps in UTC and convert only for display. Most time zone bugs come from storing local times.
- Negative timestamps are dates before 1970. -86400 is 31 December 1969.
- Daylight saving gaps mean some local times do not exist (for example 02:30 on the spring-forward night). The browser shifts those to a nearby valid time.
Sources and further reading
- POSIX Base Definitions: Seconds Since the Epoch, The Open Group. The formal definition of Unix time, with every day 86,400 seconds
- Leap Seconds FAQs, National Institute of Standards and Technology
- Date.now(), MDN Web Docs. JavaScript timestamps in milliseconds
- Date/Time Functions and Operators, PostgreSQL Global Development Group. extract(epoch ...) and to_timestamp in seconds
Frequently asked questions
How do I tell a seconds timestamp from milliseconds?
For current dates, a 10-digit number is seconds and a 13-digit number is milliseconds; 16 digits is microseconds and 19 is nanoseconds. The converter detects seconds, milliseconds and nanoseconds automatically as you type, but always check that the resulting date looks plausible.
Does Unix time include leap seconds?
No. Unix time treats every day as exactly 86,400 seconds, so the 27 leap seconds added since 1972 are not counted, and a timestamp during a leap second repeats or smears depending on the system. For almost all application work this simplification is what you want.
What is the year 2038 problem?
Signed 32-bit Unix timestamps can count only up to 2,147,483,647 seconds, which is 19 January 2038 at 03:14:07 UTC. One second later they overflow to a date in 1901. Systems that use 64-bit time, including current Linux, macOS and Windows, are unaffected.
Are nanosecond epoch timestamps converted exactly?
No. They are converted to milliseconds for display, because JavaScript Date objects have millisecond precision. Sub-millisecond digits are dropped, and 19-digit numbers are also beyond the range JavaScript numbers hold exactly, so treat the last few digits as approximate.
Which time zone does Convert to Epoch use?
Your browser's local time zone, because the date picker is a datetime-local input. 2022-01-01 00:00 entered in London gives 1640995200, while the same entry in New York gives 1641013200. Add zones in the converter to check the same instant elsewhere.
Is there an in-depth guide to the Epoch Converter?
Yes. “Master Unix Epoch Time Conversion: Complete Developer Guide to Timestamp Processing” covers the background, how it works, common pitfalls and worked examples. Read the full guide.
Related Tools You May Like
Free, in-browser tools that pair well with this one.