Unix Timestamp Converter

The left pane starts at the current Unix seconds. The bar below switches to a date and time, read as the local clock, or fills the current time again. The right pane lists local time, UTC, ISO 8601, seconds, and milliseconds for that same instant.

A Unix timestamp counts seconds from one UTC instant

POSIX time counts SI seconds from 1970-01-01 00:00:00 UTC. Leap seconds are not inserted, so every day in the counter is exactly 86400 seconds. The number is an instant, not a wall clock.

JWT exp, iat, and nbf are that count in seconds. Read the claim in the JWT decoder. A cron schedule is a different clock: it names civil times, which you can check in the cron expression generator.

Seconds, milliseconds, and the clock you print

Where the count starts, and why leap seconds are missing

  1. Zero is 1970-01-01 00:00:00 UTC, not local midnight.
  2. A negative count is an instant before that epoch.
  3. Leap seconds are not inserted. Each POSIX day is 86400 seconds, so the counter can sit a few seconds away from atomic UTC.
  4. The count does not name a time zone. A zone is applied only when a person prints a clock.

Why a value below 1e12 is seconds and a larger one is milliseconds

  1. An integer whose absolute value is below 1e12 is read as seconds. 1700000000 is 2023-11-14 22:13:20 UTC.
  2. An integer at or above 1e12 is read as milliseconds. 1700000000000 is the same instant.
  3. Ten-digit values are the usual seconds form. Thirteen-digit values are the usual milliseconds form.
  4. JavaScript Date.now() and the Date constructor use milliseconds. Dividing by 1000 is the seconds form.

What local time, UTC, and an ISO 8601 Z each mean

  1. Local time prints the instant on this machine’s zone. UTC+8 shows a clock eight hours later than UTC.
  2. The UTC line is the same instant with the offset removed.
  3. ISO 8601 ending in Z is UTC. An offset such as +08:00 is a civil time with that zone written out.
  4. A date control is a civil clock to the second. Turning it into a count applies the local offset, and the fraction of a second is zero.

Why the same second can print two different clocks

  1. Daylight-saving rules move the civil clock without changing the underlying count.
  2. China used daylight saving in 1986–1991. From 1992, Asia/Shanghai stays at UTC+8, so a flat “plus eight hours” is wrong for some earlier instants.
  3. A 32-bit signed second overflows at 2147483647, which is 2038-01-19 03:14:07 UTC. That limit is the storage width, not the end of the epoch.
  4. SQL timestamp without time zone stores a civil clock. timestamptz stores an instant. Mixing the two shifts the reading by the session zone.

Where the unit is easy to get wrong

JWT exp

RFC 7519 NumericDate is seconds. A millisecond exp looks decades past the real expiry. Compare it with the seconds line, then open the token in the JWT decoder.

Logs and database columns

A 10-digit log field is seconds. A Java or JavaScript field is often milliseconds. A timestamp without time zone still needs the zone the writer assumed.

Frequently asked questions

How do I tell seconds from milliseconds?
Below 1e12, the integer is seconds. At or above 1e12, it is milliseconds. 1700000000 and 1700000000000 are one instant: 2023-11-14T22:13:20.000Z.
Why does the count start in 1970?
That UTC midnight is the Unix epoch. Zero is that instant. The choice is a convention, not a property of calendars.
Are leap seconds included?
No. POSIX days are exactly 86400 seconds. Leap seconds are handled outside the counter, so it can differ by a few seconds from atomic UTC.
Why is the local clock hours away from UTC?
The count has no zone. Local time adds this machine’s offset. UTC+8 prints 06:13:20 on the next civil day for 2023-11-14 22:13:20 UTC.
Is JWT exp seconds or milliseconds?
Seconds. RFC 7519 NumericDate counts seconds from the epoch. A 13-digit exp is a millisecond value placed in a seconds field.
What unit does JavaScript Date.now() use?
Milliseconds. new Date(1700000000) is about 20 days after the epoch, because that number is read as milliseconds. new Date(1700000000000) is the 2023 instant.
Can a timestamp be negative?
Yes. A negative count is before 1970-01-01 00:00:00 UTC. The same seconds-versus-milliseconds rule uses the absolute value.
What does the Z on an ISO 8601 time mean?
Z means the clock is UTC, with a zero offset. +08:00 means that civil time is eight hours ahead of UTC. They can name the same instant.