Unix Timestamp Seconds vs Milliseconds — How to Tell the Difference

One number, two units — and mixing them up is the most common timestamp bug. Learn the 10-second test that tells seconds from milliseconds.

Check your timestamp — seconds or milliseconds, free →

Free · No signup · No watermark · Private

The 10-second test: count the digits

A Unix timestamp counts time since 00:00:00 UTC on 1 January 1970. The catch is that different systems count in different units — and the same moment looks completely different in each:

  • 10 digits (e.g. 1793700000) = seconds — classic Unix time.
  • 13 digits (e.g. 1793700000000) = milliseconds — what JavaScript's Date.now() returns.

For dates near today, that digit count is almost always enough. As a second check, look at the magnitude: right now the epoch in seconds is about 1.8 billion, while in milliseconds it is about 1.8 trillion. If your value is near 1.8 billion, it is seconds; near 1.8 trillion, it is milliseconds.

What does a 13-digit timestamp mean?

A 13-digit timestamp is a millisecond timestamp. It is the unit JavaScript uses everywhere (Date.now(), new Date().getTime()) and Java's System.currentTimeMillis() returns. So if an API hands you 13 digits and your code expects seconds, you must divide by 1,000 before using it — otherwise your date lands tens of thousands of years in the future.

Why your date shows January 1970

This is the #1 symptom of the seconds-vs-milliseconds mix-up. JavaScript's Date expects milliseconds. Pass it seconds and it thinks only a few weeks have passed since 1970:

new Date(1700000000) → a date in January 1970. The fix is one multiplication: new Date(1700000000 * 1000) → 14 November 2023. If your UI suddenly shows 1970 for every date, you almost certainly fed seconds where milliseconds were expected.

Why your date shows the year 55,000

The mirror-image bug: milliseconds fed where seconds were expected. A backend or library that multiplies by 1,000 again — or a Python datetime.fromtimestamp() given milliseconds — turns a 2023 date into a date tens of thousands of years ahead. The fix is the reverse: divide by 1,000.

Who uses which unit?

  • Seconds: classic Unix time, PHP time(), Python time.time() (as a float), Go time.Now().Unix(), most databases, and JWT time claims (exp, iat, nbf are always seconds).
  • Milliseconds: JavaScript Date.now(), Java System.currentTimeMillis(), Go UnixMilli().

When in doubt, check the API's documentation — the unit is part of the contract, and guessing wrong by 1,000× is silent: no error, just a wildly wrong date.

Edge cases where digit-counting breaks

Digit counting works for dates near today, but it is a heuristic, not a rule:

  • Old dates: seconds timestamps before September 2001 have only 9 digits, and millisecond timestamps before 2001 can have 12.
  • 11-digit values are suspicious for a current date — too big for today's seconds, too small for today's milliseconds — so check the source before trusting them.
  • 16 digits usually means microseconds and 19 digits nanoseconds (common in logging and tracing systems). Divide by 1,000,000 or 1,000,000,000 respectively to get seconds.
  • Negative values are dates before 1 January 1970, not errors.

How to check one timestamp right now

  1. Open the Timestamp Converter.
  2. Paste the number — it auto-detects seconds versus milliseconds and shows the date in UTC and your local time.
  3. If the date looks wrong by a factor of 1,000, you have found your bug: multiply or divide by 1,000 and convert again.

Note the honest limit: the converter handles seconds and milliseconds. If you have microseconds or nanoseconds, divide first (by 1,000,000 or 1,000,000,000) and then paste the result.

Fix it in code, once

JavaScript: new Date(seconds * 1000) to display, Math.floor(Date.now() / 1000) to send seconds to an API. Python: datetime.fromtimestamp(ms / 1000, timezone.utc). A common display guard is the 1e11 threshold — below it, treat the value as seconds; above it, as milliseconds — but only use that for display, never as a substitute for knowing the API's unit. And remember the 2038 problem: a signed 32-bit integer maxes out at 2,147,483,647 seconds (19 January 2038), so modern systems store timestamps in 64-bit integers.

Frequently asked questions

How do I tell if a timestamp is in seconds or milliseconds?

Count the digits: for dates near today, 10 digits means seconds and 13 digits means milliseconds. As a cross-check, compare magnitude — about 1.8 billion is seconds, about 1.8 trillion is milliseconds. For old dates or unusual digit counts, check the API documentation instead of guessing.

What does a 13-digit timestamp mean?

It is a millisecond timestamp — the unit JavaScript's Date.now() and Java's System.currentTimeMillis() return. Divide by 1,000 to get classic Unix seconds.

Why does my date show January 1970?

You almost certainly passed seconds to something expecting milliseconds. JavaScript's Date takes milliseconds, so a seconds value looks like only a few weeks after the 1970 epoch. Multiply by 1,000 first.

Why does my date show a year like 55,000?

The reverse bug: milliseconds passed where seconds were expected, so the value is 1,000× too large. Divide by 1,000 before converting.

Can a Unix timestamp be negative?

Yes — negative timestamps are dates before 1 January 1970. They are valid, not errors.

Does the converter handle microseconds or nanoseconds?

No — it auto-detects seconds and milliseconds only. For 16-digit microseconds divide by 1,000,000 first, and for 19-digit nanoseconds divide by 1,000,000,000, then paste the result.

Try it now

Ready? Check whether your timestamp is seconds or milliseconds — free, instant, no signup.

Related tools