Step-by-step
- Count the digits of the timestamp.
- Ten digits is almost certainly seconds. Thirteen digits is almost certainly milliseconds.
- Enter the value in the Unix Timestamp Converter, which reads 13 or more digits as milliseconds.
- Check that the date is the one you expect.
- To convert, divide milliseconds by 1,000 to get seconds, or multiply seconds by 1,000 to get milliseconds.
Which systems use which unit
JavaScript's Date.now() and Java's System.currentTimeMillis() return milliseconds. Python's time.time() returns seconds as a decimal number, and many databases and APIs use whole seconds. The exp and iat claims in a JWT are in seconds.
Signs that the unit is wrong
A date in January 1970 usually means a seconds value was read as milliseconds. A date tens of thousands of years in the future means a milliseconds value was read as seconds. Always check the first date you see against what you expect.
Example
1700000000 is 14 November 2023 22:13:20 UTC in seconds. The same moment is 1700000000000 in milliseconds. Reading the milliseconds value as seconds gives a year far beyond 50000.
Finish the task with DevUtilityKits
Use the relevant online utility, check the result, and continue with your development workflow.
Open Unix Timestamp Converter →Open Timestamp to Date →