Convert Unix timestamps
Paste a timestamp or a date and every other form of it appears below. The box starts on the current time, and the readable rows follow your browser’s own clock.
How to use it#
- Paste a timestamp, or click Use current time to start from now.
- If the number is close to 1970, set the unit rather than leaving it on Auto.
- Switch between your zone and UTC to reread the same instant, then copy the row you need.
Seconds, milliseconds, and how to tell them apart#
A Unix timestamp counts from midnight UTC on 1 January 1970. Unix itself, and most databases and APIs, count in seconds. JavaScript counts in milliseconds, which is the single most common cause of a date landing in 1970 or in the year 54,000.
Length is the quick test. A current timestamp in seconds has ten digits; in milliseconds it has thirteen. That rule holds from 2001 until 2286, which covers anything you are likely to be debugging.
The rule breaks for dates near the epoch itself, where a seconds value has far fewer digits and could plausibly be either. Auto detection here guesses by magnitude and gets it right for any modern date, but the unit is a setting you can override precisely because the guess is not always right.
Why the readable time depends on where you are#
A timestamp has no time zone. It is a count of seconds since a fixed instant, and it means the same moment everywhere on earth. The zone only matters when you turn it into something a person reads, because that is when the clock on the wall gets involved.
The two readable rows on this page show the same instant twice. Switching between them changes nothing about the underlying value, which is why the Unix and ISO rows do not move when you toggle it. If a bug report and a log file disagree about when something happened, this is usually where the disagreement lives.
ISO 8601 with a trailing Z is the safest thing to write down, because it is unambiguous and sorts correctly as plain text. A date written as 03/04/2023 is not, and which of March and April it means depends on who typed it.
The 2038 problem, briefly#
Systems that store a timestamp as a signed 32-bit integer run out of room on 19 January 2038, when the count exceeds 2,147,483,647 and wraps to a negative number near 1901. It is the same shape of problem as Y2K and it is still present in older embedded systems and some database columns.
Modern languages use 64-bit values and are unaffected. If you maintain something that stores epoch seconds in a 32-bit column, that column is the thing to find, and the fix is widening it rather than doing anything clever with the values already in it.
Frequently asked questions#
Is my timestamp in seconds or milliseconds?
#
Count the digits. A present-day timestamp has ten digits in seconds and thirteen in milliseconds. Auto detection uses the same rule, treating anything of eleven digits or more as milliseconds. For a date close to 1970 the digit count no longer distinguishes them, so set the unit yourself.
Why does the date shown differ from my colleague’s?
#
The timestamp is identical; the zone used to display it is not. Switch the readable rows to UTC and compare those instead, which removes the zone from the conversation entirely.
Can I convert a date from before 1970?
#
Yes. Timestamps before the epoch are negative, so -86400 is 31 December 1969. Paste a negative number or an ISO date and it converts normally.
What format should I paste a date in?
#
ISO 8601 is the reliable choice, for example 2023-11-14T22:13:20Z. Other formats are passed to your browser’s date parser, which accepts many of them but is inconsistent between browsers for anything ambiguous.
Does the relative time keep updating?
#
Yes, it refreshes every second against your clock, so a timestamp a minute in the past keeps counting. The other rows are fixed, because the instant itself has not changed.