2026-05-31 · 1 min read
Unix timestamps: seconds vs milliseconds
Know the unit before you convert—off-by-1000 bugs are common.
Key takeaways
- APIs disagree on seconds vs ms—read the docs.
- Always check timezone when comparing to local clocks.
Get the unit right
JavaScript Date often uses milliseconds while many APIs return seconds.
When in doubt, write down an example known time and round-trip it through the converter.
Pair with schedules
If you are aligning cron schedules with absolute times, Cron Parser complements timestamp checks for human-readable schedules.
Date.now vs Unix seconds
Date.now() is 13 digits (ms). Linux `date +%s` is 10 digits (s). Pasting a 13-digit value into a seconds field produces a year in the 50,000s—toggle the unit before trusting logs.
Python time.time() is float seconds; multiply by 1000 only when the downstream API documents milliseconds.
FAQ
Why is my date in 1970 or 2286?
Usually wrong unit (seconds treated as ms or the opposite).
Does UTC matter?
Unix time is UTC-based; local display still depends on your environment.