Developer & Tech
Unix Timestamp Converter
Enter your details
Runs in your browser
How to use it
Using the unix timestamp converter
- 01
Paste any timestamp form
Epoch seconds from a database, milliseconds from JavaScript, or an ISO string from an API log.
- 02
Read all representations
Seconds, milliseconds and ISO UTC appear together so cross-format debugging takes one glance.
- 03
Sanity-check relatively
The “X ago” row instantly exposes unit mistakes; a wrong guess reads as millennia away.
Good to know
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
How it's calculated
The math behind this calculator
ms > 1e11 → read as milliseconds; else seconds; then derive all other representationsPurely 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.
FAQ
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.
Keep exploring