CalcOak

Unix Timestamp Converter: turn epoch seconds or milliseconds into a readable date, and back again

Current Unix time (seconds)

—

Milliseconds

—

Timestamp → date

ISO 8601 (UTC)
RFC 2822
Your local time
Selected zone
Day of week
Relative

Date → timestamp

Seconds

Milliseconds

Getting the current timestamp in code
JavaScriptMath.floor(Date.now() / 1000) (seconds) · Date.now() (ms)
Pythonimport time; int(time.time())
PHPtime();
MySQLSELECT UNIX_TIMESTAMP(); · FROM_UNIXTIME(1700000000)
JavaSystem.currentTimeMillis() (ms) · Instant.now().getEpochSecond()
Shelldate +%s

How to use the Unix timestamp converter

The two counters at the top tick once a second and show the present moment as Unix seconds and milliseconds; press Copy on either to paste it into a script or a test fixture. To decode a value you already have, type it into the timestamp box. The tool looks at the number of digits and labels it as seconds, milliseconds, microseconds or nanoseconds, and you can override that guess from the unit menu when a log format is unusual. The result appears as an ISO 8601 string in UTC, in RFC 2822 form for email and HTTP headers, in your browser's own zone, and in any of the zones from the list, together with the weekday and how long ago (or how far ahead) that instant is.

To go the other way, pick a date and time in the lower section and choose the zone that wall-clock time belongs to. A build server in Frankfurt writing "2024-07-01 12:00" means something different from a phone in Tokyo writing the same digits, and the zone menu settles which one you mean. On a spring-forward night, a time that never happened (02:30 in New York on 10 March 2024, for example) is moved to the next valid minute and flagged, and a time that happens twice in autumn is noted so you can pick the earlier or later instant deliberately.

Why timestamps go wrong and how the converter helps

Unix time is the number of seconds since midnight UTC on 1 January 1970. It is compact, sorts correctly and has no time zone, which is why databases, cookies, JWTs and most APIs use it. The classic mistake is mixing scales: JavaScript's Date.now() counts milliseconds, while Python, PHP and MySQL count seconds. Feed a 13-digit millisecond value into a function expecting seconds and the date lands somewhere around the year 55,800; do the reverse and everything collapses into the first three weeks of January 1970. Seeing the detected unit next to the input catches that before it reaches production.

The second source of confusion is the zone in which a value was created. A timestamp itself is unambiguous, but the moment a human types a date into a form, the server has to decide whether "9 am" meant London or Los Angeles, and the two differ by eight hours, or by seven for a few weeks each spring and autumn. Showing the same instant in UTC, in your local zone and in a chosen zone side by side makes an eight-hour discrepancy obvious rather than mysterious. Everything runs in the browser and nothing you type is sent anywhere.

Further reading

Frequently asked questions

Is my timestamp in seconds or milliseconds?+

Count the digits. Any date between 2001 and 2286 is a 10-digit number in seconds and a 13-digit number in milliseconds, so 1700000000 is seconds and 1700000000000 is milliseconds for the same moment. The converter guesses from the digit count and shows the guess beside the input; if you know better, pick the unit yourself from the menu. Microseconds (16 digits) and nanoseconds (19 digits) are handled the same way.

Can a Unix timestamp be negative?+

Yes. Zero is 1 January 1970 00:00:00 UTC, so anything earlier is negative: -86400 is 31 December 1969 and -2208988800 is the start of 1900. Type the minus sign and the tool converts it like any other value. Some older systems and databases refuse negative values, so if you store dates before 1970 check that the target column or field accepts them.

What is the year 2038 problem?+

Systems that store a timestamp as a signed 32-bit integer cannot count past 2,147,483,647, which is 19 January 2038 at 03:14:07 UTC. One second later the value wraps to a large negative number and the date jumps back to 1901. Modern operating systems, languages and databases use 64-bit integers, so this mostly affects embedded devices and old file formats, but it is worth knowing if you set expiry dates decades ahead.

Why does the local time differ from the ISO 8601 result?+

A timestamp identifies one instant, but the clock reading for that instant depends on the zone. The ISO line is always in UTC (marked with Z), the local line uses whatever zone your browser reports, and the extra line uses the zone you choose. Between them they show the same moment three ways, which is usually enough to spot where an off-by-hours bug is coming from.

Does Unix time include leap seconds?+

No. Unix time pretends every day has exactly 86,400 seconds, so when a leap second is inserted the count simply repeats or smears a second rather than adding one. That is why converting a timestamp to a date is pure arithmetic and why this tool matches the results of Date, time.time() and UNIX_TIMESTAMP() exactly, even though 27 real leap seconds have passed since 1972.