AppHelp guide
Unix Timestamp Seconds vs Milliseconds
Learn how to identify 10-digit Unix seconds, 13-digit Unix milliseconds, UTC ISO output, and common timestamp conversion mistakes.
Quick answer
A 10-digit Unix timestamp usually stores seconds since 1970-01-01 00:00:00 UTC. A 13-digit Unix timestamp usually stores milliseconds. JavaScript Date uses milliseconds, while many APIs and databases store seconds.
How to tell which unit you have
Count the digits before converting. Current Unix seconds are usually 10 digits, while current Unix milliseconds are usually 13 digits. If a date appears thousands of years in the future, seconds and milliseconds were probably mixed up.
- 1700000000 means Unix seconds
- 1700000000000 means Unix milliseconds
- UTC ISO output should end with Z when it is normalized to UTC
Where each format appears
API fields such as created_at and expires_at often use seconds. JavaScript, browser dates, and many log processors often use milliseconds. ISO 8601 strings are clearer for humans because the unit is explicit.
Common mistakes
Do not compare local display time with UTC output without checking the time zone. A local date picker may create a local-time value, while an ISO string ending in Z represents UTC.
Frequently asked questions
How do I tell whether a Unix timestamp uses seconds or milliseconds?
Count the digits before converting. Current Unix seconds are usually 10 digits, while current Unix milliseconds are usually 13 digits.
Why does JavaScript show the wrong date for a Unix timestamp?
JavaScript Date expects milliseconds. If an API gives seconds, multiply the value by 1000 before creating the Date.