LocalDevTools

Unix Timestamp Converter

Turn an epoch timestamp from a log, database or API into a readable date in any time zone, or get the timestamp for a specific date and time. Seconds, milliseconds, microseconds and nanoseconds are detected automatically.

–Current Unix time (seconds)
–Milliseconds

Timestamp → date

Date → timestamp

Runs entirely in your browser. Your input is never uploaded or stored on a server.

How to convert a Unix timestamp

  1. Paste the timestamp. The tool guesses the unit from the number of digits: 10 digits is seconds, 13 milliseconds, 16 microseconds and 19 nanoseconds (for present-day dates). You can override the guess.
  2. Pick a time zone to see the date there. The table also shows UTC, your browser's local time, ISO 8601 and a relative time like "3 days ago".
  3. To go the other way, pick a date and time and the zone it is in. You get the timestamp in seconds and milliseconds, correctly adjusted for daylight saving time.

What is Unix time?

Unix time counts the seconds since 00:00:00 UTC on 1 January 1970 (the "epoch"), ignoring leap seconds. Because it is just a number with no time zone, it is the most reliable way to store and exchange moments in time. Time zones only matter when you display it to a person.

Examples

01970-01-01T00:00:00Z — the epoch
17000000002023-11-14T22:13:20Z
1700000000000Same moment in milliseconds (JavaScript Date.now() style)
21474836472038-01-19T03:14:07Z — the largest signed 32-bit value (the "Year 2038 problem")

Getting the current timestamp in code

Math.floor(Date.now() / 1000)        // JavaScript (seconds)
import time; int(time.time())        # Python
date +%s                             # Linux / macOS shell
SELECT EXTRACT(EPOCH FROM now());    -- PostgreSQL
SELECT UNIX_TIMESTAMP();             -- MySQL

Common pitfalls

  • Seconds vs milliseconds. JavaScript and Java use milliseconds; most Unix tools, Python's time.time() and JWTs use seconds. If a converted date lands in January 1970, a seconds value was probably treated as milliseconds. A date tens of thousands of years in the future means the opposite.
  • Local time on servers. Converting with a server's local zone gives different results on machines in different regions. Store UTC timestamps and convert at the edge.
  • Daylight saving gaps. Some local times do not exist (clocks jump forward) and some happen twice (clocks go back). This tool resolves them the same way browsers do.

Frequently asked questions

How do I know if my timestamp is in seconds or milliseconds?

Count the digits. Current dates are 10 digits in seconds and 13 in milliseconds. The auto-detect option does this for you and says which unit it chose.

Does Unix time include leap seconds?

No. Unix time assumes every day has exactly 86,400 seconds. Around a leap second, systems either repeat a second or smear it over a longer period.

What is the Year 2038 problem?

Systems that store Unix time in a signed 32-bit integer overflow at 03:14:07 UTC on 19 January 2038. Modern 64-bit systems are not affected, but old embedded devices and some file formats are.

Can I convert negative timestamps?

Yes. Negative values are dates before 1970, for example -86400 is 31 December 1969.

Which time zones are supported?

Every IANA time zone your browser knows (such as America/New_York, Europe/London or Asia/Tokyo), with daylight saving rules applied automatically.

Related tools

Last updated: