Convert a Unix timestamp to a date

Paste a Unix timestamp and see it as an ISO 8601 date, a UTC date and a relative time — or paste a date and get the timestamp in seconds and milliseconds. The unit is detected from the size of the number, because reading milliseconds as seconds (or the reverse) is the most common way an expiry check ends up 50,000 years off.

Seconds or milliseconds

Unix time counts seconds since 1970-01-01 UTC; JavaScript’s Date.now() counts milliseconds. JWT exp, iat and nbf claims are seconds. A ten-digit number is seconds in this era and a thirteen-digit one is milliseconds — this tool reads anything above 100 billion as milliseconds, and larger values as micro- or nanoseconds.

Always compare in UTC

A timestamp has no time zone; the date you display does. Tests that compare formatted local dates fail on a CI runner in a different zone. Compare the numbers, or ISO strings with an explicit Z, and convert to local time only for display.

Expiry tests

To test that a token or a hold expires, read its expiry as a timestamp, check it is in the future when issued and in the past after waiting — and allow a small clock skew between client and server rather than asserting to the second.

Other tools

All tools · Getting started guide · All 55 mock REST APIs

Last updated