Developer & Tech

Unix Timestamp Converter

What this does

Convert Unix seconds, milliseconds or ISO 8601 strings into every other format automatically, with relative-time context included.

Enter your details

Runs in your browser

Calculator inputs

Using the unix timestamp converter

  1. 01

    Paste any timestamp form

    Epoch seconds from a database, milliseconds from JavaScript, or an ISO string from an API log.

  2. 02

    Read all representations

    Seconds, milliseconds and ISO UTC appear together so cross-format debugging takes one glance.

  3. 03

    Sanity-check relatively

    The “X ago” row instantly exposes unit mistakes; a wrong guess reads as millennia away.

Why magnitude auto-detection works

Seconds since 1970 crossed 1e11 only around the year 5138; milliseconds passed that mark in 1973. The threshold cleanly separates the two formats for any realistic timestamp, making conversion frictionless without a mode switch.

Timestamp bugs worth avoiding

  • Storing seconds in a millisecond column (or vice versa) silently corrupts sorting
  • new Date(string) parses differently across engines for non-ISO strings
  • Always serialize UTC; convert to local time only at display
  • JavaScript Date lacks minutes-level precision beyond ±8.64e15 ms

The math behind this calculator

ms > 1e11 → read as milliseconds; else seconds; then derive all other representations

Purely numeric input auto-detects its unit by magnitude: absolute values above one hundred billion can only be milliseconds, anything smaller reads as seconds. Non-numeric input attempts ISO 8601 parsing through the standard Date constructor.

Once parsed, the instant renders simultaneously as Unix seconds, Unix milliseconds and an ISO UTC string, plus a coarse relative description (“in 3 days”, “2 hours ago”) computed against your current clock for instant sanity checking.

Assumptions & limitations

  • All output is UTC; local time zones affect display only.
  • Magnitude detection assumes modern epochs; dates before 1973 in seconds look like milliseconds edge cases.
  • Leap seconds are ignored, per Unix-time convention.

Worked example

The round number 1,700,000,000 seconds lands on 2023-11-14T22:13:20Z; late evening UTC, handy for spotting off-by-a-day bugs.

Frequently asked questions

How does it tell seconds from milliseconds?
Pure numbers with absolute value over 100 billion are treated as milliseconds; otherwise seconds. Dates before 1973 are the rare ambiguity zone.
Is the ISO output always UTC?
Yes; toISOString() is defined as UTC with Z suffix. Convert to your time zone at presentation time, never before storage.
Can I convert negative timestamps?
Yes; pre-1970 dates work as negative seconds/milliseconds throughout.
Why does my relative time say “55 years ago” for a small number?
You likely pasted milliseconds into what was interpreted as seconds (or vice versa). The “interpreted as” row shows exactly which reading happened.

Related calculators