Unix Timestamp Converter
Seconds or milliseconds, told apart by magnitude.
Tue, 14 Nov 2023 22:13:20 GMT
- 1,700,000,000
- Seconds
- 1,700,000,000,000
- Milliseconds
- 2023-11-14T22:13:20.000Z
- ISO 8601
- Tuesday
- Day
- 3 years ago
- Relative
Tue Nov 14 2023 22:13:20 GMT+0000 (Coordinated Universal Time)
The Unix timestamp converter turns an epoch number into a readable date and a date back into a timestamp, in both seconds and milliseconds. It tells the two apart by magnitude, which is the mistake that puts a date in the year 56000.
How it works
Unix time counts seconds since midnight UTC on 1 January 1970, ignoring leap seconds. It is a single number with no time zone, which is exactly why systems store it. A timestamp means the same instant everywhere.
- A ten-digit value is seconds. A thirteen-digit value is milliseconds, which is what JavaScript's Date.now() returns.
- Anything above about 1e11 is treated as milliseconds, because seconds will not reach that magnitude until the year 5138.
- The result is shown in UTC and in your local time, which differ by your offset and possibly by daylight saving.
- Negative timestamps are valid and represent dates before 1970.
On the 2038 problem: a signed 32-bit timestamp overflows on 19 January 2038, wrapping to 1901. Most modern systems use 64-bit values and are unaffected, but embedded systems and old file formats still carry the limitation.
Examples
A timestamp in seconds
Timestamp
1700000000
Result
Tue, 14 Nov 2023 22:13:20 GMT
Ten digits, so seconds. A round number like this is a common test value.
The same instant in milliseconds
Timestamp
1700000000000
Result
The same date
Thirteen digits, so milliseconds. Read as seconds it would be the year 55839, which is how this mistake announces itself.
The epoch itself
Timestamp
0
Result
Thu, 01 Jan 1970 00:00:00 GMT
A date field showing 1 January 1970 almost always means a timestamp was missing and defaulted to zero.
Frequently asked questions
Is my timestamp in seconds or milliseconds?
Count the digits. Ten digits is seconds, thirteen is milliseconds. Unix time in seconds will not reach eleven digits until the year 5138, so anything longer than ten digits today is milliseconds. JavaScript works in milliseconds; most other languages default to seconds.
Why does my date show as 1 January 1970?
Because the timestamp was zero, which usually means a value was missing, null, or failed to parse and defaulted. It is one of the most recognisable bugs in software, the epoch showing up where a real date should be.
Does a Unix timestamp have a time zone?
No, and that is the point. It counts seconds since a fixed instant, so the same number means the same moment everywhere on Earth. The time zone only enters when you format it for display, which is why the same timestamp shows different clock times in different places.
What is the 2038 problem?
A signed 32-bit integer can hold seconds only up to 03:14:07 UTC on 19 January 2038, after which it wraps to 1901. Modern systems use 64-bit timestamps and are fine for another 292 billion years. Embedded devices and older file formats are where it still bites.
Does Unix time account for leap seconds?
No. It assumes every day has exactly 86,400 seconds, so it is not a true count of elapsed seconds since 1970. It is currently around 27 seconds adrift. This almost never matters, and when it does you need TAI rather than Unix time.