Skip to content

Unix Timestamp Seconds vs Milliseconds — How to Tell Them Apart

Published July 12, 2026By Samson P G

A 13-digit “timestamp” is not the same unit as a 10-digit one. Mixing them up shifts dates by centuries — or makes every API look broken.

A Unix timestamp counts time since the Unix epoch: 1970-01-01T00:00:00Z. The confusion starts when one system uses seconds and another uses milliseconds (or microseconds) but both call the field timestamp.

Seconds vs milliseconds at a glance

Form Typical digits (2020s) Example (approx.)
Seconds 10 1719792000
Milliseconds 13 1719792000000
Microseconds 16 rarely in JS APIs

Rule of thumb for modern dates: 10 digits → seconds, 13 digits → milliseconds. Values like 1719792000000 interpreted as seconds land near the year 56447, which is a classic bug footprint.

Where each shows up

  • Unix / Linux / many databases — seconds (time(), PostgreSQL EXTRACT(EPOCH ...)).
  • JavaScript Date.now() — milliseconds.
  • Java System.currentTimeMillis() — milliseconds.
  • APIs — either; check the docs. Stripe-like APIs often use seconds; browser-heavy APIs often use ms.

Conversion formulas

  • Seconds → milliseconds: seconds * 1000
  • Milliseconds → seconds: Math.floor(ms / 1000) (or truncate toward zero carefully with negatives)
  • Seconds → ISO UTC in JS: new Date(seconds * 1000).toISOString()
  • Milliseconds → ISO UTC in JS: new Date(ms).toISOString()

Never feed a 13-digit value into an API that expects seconds without dividing. Never multiply a seconds value again if it is already ms.

Debugging checklist

  1. Count the digits (and sign/decimal).
  2. Convert assuming seconds; if the year is absurd, try milliseconds.
  3. Confirm timezone: epoch is UTC; local display can shift the calendar day.
  4. Watch for stringified floats (1719792000.5) — some systems store fractional seconds.

Use DevSnip Timestamp Converter

DevSnip Timestamp Converter converts Unix epoch values to human-readable dates and back, with a live clock for sanity checks. Run it locally in the browser when you are mid-debug and do not want another tab stealing focus — or leaking request samples.

Privacy one-liner: conversion happens on your device; nothing is uploaded.

FAQ

Why did my date jump to 1970?

You probably passed milliseconds into an API that expects seconds (or seconds into a function that expects ms and treated a small number as ms from epoch).

What about nanoseconds?

Less common in web APIs. If you see 19-digit integers, check the producer (e.g. some Go/time libraries). Convert with the documented unit, not digit counting alone.

Is epoch always UTC?

Yes for the count itself. Display zones are separate. “Unix time in IST” usually means “show the UTC instant formatted in IST.”

Can I convert ISO strings the other way?

Yes — parse the ISO date, then take seconds or milliseconds with getTime() / division as needed. The converter helps when you are bouncing between forms quickly.

← More from the blog