Why is my timestamp 13 digits?
A 13-digit timestamp is a Unix timestamp in milliseconds: the number of milliseconds since 1970-01-01T00:00:00Z instead of the number of seconds. Ten digits is seconds and 13 is milliseconds, so 1700000000 and 1700000000000 are the same instant, a factor of 1,000 apart. Paste yours below to see which unit it is and what date it holds.
Tell the unit by counting digits
Unix time counts from midnight UTC on 1 January 1970, and each unit is a factor of 1,000 from the next. For any date between September 2001 and the year 2286, seconds take 10 digits. Milliseconds take 13, microseconds 16 and nanoseconds 19. So 1700000000 is 14 November 2023 at 22:13:20 UTC, and 1700000000000 is the same instant to the millisecond. The length is the tell. A 12-digit value is still milliseconds, from a date between 1973 and 2001.
parsetime applies the same rule. It reads the unit from the length of the number and names it above the result, so a millisecond value and a seconds value both come out as November 2023.
What happens when you mix them up
Pass a millisecond value to code that expects seconds and the date lands in the year 55840. Python's datetime.fromtimestamp(1700000000000) raises ValueError: year 55840 is out of range, and a database that accepts it stores a date tens of thousands of years out. Pass seconds where milliseconds are expected and you get the opposite: new Date(1700000000) in JavaScript is 20 January 1970 at 16:13:20 UTC, less than three weeks after the epoch.
Both symptoms are the same bug seen from either side. A date in January 1970 means the value was too small by 1,000. A date with a five-digit year means it was too large by 1,000.
Which languages give you which unit
JavaScript's Date.now() and Java's System.currentTimeMillis() return milliseconds, which is why 13-digit values fill logs, JSON payloads and browser code. Python's time.time() returns seconds as a float, so int(time.time()) is 10 digits. Go's time.Now().Unix() is seconds and time.Now().UnixMilli() is milliseconds. Ruby's Time.now.to_i and the shell's date +%s are seconds. PostgreSQL's extract(epoch from now()) is seconds with a fraction. Java's Instant.now().getEpochSecond() is seconds too, so one language can hand you both units.
When two systems disagree by a factor of 1,000, the one written in JavaScript or Java is usually the one sending milliseconds.
How to convert between seconds and milliseconds
Divide by 1,000 to go from milliseconds to seconds, and keep the remainder if you need it: 1700000000123 is 1700000000 seconds plus 123 milliseconds. Integer division drops the fraction, so Math.floor(ms / 1000) in JavaScript and ms // 1000 in Python both give 1700000000. Multiply by 1,000 to go the other way.
Keep the value as an integer while you do it. A 32-bit float holds about seven significant digits, so a 13-digit count that passes through one comes back changed. A 64-bit double is exact up to 2^53, which covers every millisecond timestamp. If you only need the date, paste the number below: parsetime shows the seconds and milliseconds forms side by side.
Try it with the converter
Detected: Unix timestamp (milliseconds)/t/1700000000000
Your timezone
UTC · GMT+00:00 · UTC
Tue, Nov 14, 2023, 10:13:20 PM
Common formats
UTC
Tue, Nov 14, 2023, 10:13:20 PM
ISO 8601
2023-11-14T22:13:20.000Z
Unix (seconds)
1700000000
Unix (millis)
1700000000000
Relative
…
Common questions
- Is a 13-digit timestamp seconds or milliseconds?
- Milliseconds. Current Unix time in seconds is 10 digits, so a 13-digit value is the same count multiplied by 1,000.
- How do I convert a 13-digit timestamp to a date?
- Paste it above. parsetime detects the unit and shows the date in your timezone, in UTC and in ISO 8601, with the 10-digit seconds value next to it.
- Why does my timestamp show a date in 1970?
- The value was in seconds but was read as milliseconds, so it landed within weeks of the epoch. Multiply by 1,000 or pass it to an API that expects seconds.
- What is 1700000000000 as a date?
- 14 November 2023 at 22:13:20 UTC. It is 1700000000 seconds, written in milliseconds.