Unix Timestamp Digits: How to Tell Seconds from Milliseconds

Contents
When you see a number like 1784298258 in an API response or a server log, you can tell exactly what moment it points to just by counting its digits. Unix timestamps have a fixed digit range depending on whether they're in seconds or milliseconds.
If you don't know this rule and drop the number straight into a JavaScript Date constructor, you'll get an absurd date — somewhere around the 1970s, or a year in the tens of thousands. This post lays out the rule for telling seconds, milliseconds, microseconds, and nanoseconds apart by digit count alone.
Summary ① A digit count of 1–11 means seconds, 12–14 means milliseconds, 15–17 means microseconds, and 18 or more means nanoseconds. ② Mistaking a 10-digit seconds value for milliseconds and passing it to Date lands you near 1970, and mistaking a 13-digit milliseconds value for seconds and multiplying by 1000 gives you a year in the tens of thousands. ③ The same timestamp looks different in UTC and in local time by the time zone offset, and negative values mean a moment before 1970.
Why mix-ups over digit counts actually happen in real work
Server logs and API responses often print timestamps as bare numbers with no unit label. Some systems hand back seconds and others hand back milliseconds, so even when the field name is the same (created_at, timestamp, and so on), the actual value can have a different digit count.
The catch is that JavaScript's Date constructor always works in milliseconds. new Date(x) interprets x as the number of milliseconds since midnight on January 1, 1970 (UTC).
Put a seconds value in there unchanged and you've read a number 1000 times too small as milliseconds, so the resulting date snaps back to somewhere around 1970.
The mistake goes the other way too. Mistake a milliseconds value for seconds, multiply by 1000, and pass it to Date, and the date jumps 1000 times further into the future than it should be. Both mistakes run without any error, which is why you usually don't notice until a bizarre date shows up on screen.
How to work it out yourself by counting digits, no tool needed
The rule, and why 11 digits is the cutoff
Here's the rule. Count the digits in the integer part: 1–11 digits means seconds, 12–14 means milliseconds, 15–17 means microseconds, and 18 or more means nanoseconds.
There's a reason the boundary sits at 11 digits. The largest 11-digit number, 99999999999, converts to November 16, 5138 when read as seconds.
In other words, a seconds timestamp can express dates all the way to 5138 AD with just 11 digits, so if you're looking at a number with 12 or more digits, it's far more likely to be a smaller unit than seconds.
Checking it with real numbers
Let's verify with real numbers. At the time of writing, the seconds timestamp is 1784298258 (10 digits), and read correctly as seconds that's July 17, 2026, 14:24 (UTC).
But if you mistakenly drop that number into the milliseconds slot as new Date(1784298258), the result is January 21, 1970. That's because 1,784,298,258 milliseconds is only about 20 days.
The milliseconds value for the same moment is 1784298258087 (13 digits). Mistake it for seconds, multiply by 1000, and pass it in as new Date(1784298258087 * 1000), and you get the year 58512 AD — a date that can't exist.
The steps in order
Here's the order of operations.
- Count the digits in the number.
- Pick the unit using the digit rule (the 11 / 14 / 17 digit boundaries).
- If it's milliseconds, divide by 1000 to get seconds — or, to feed seconds into a JavaScript Date, multiply by 1000 to get milliseconds instead.
- Check the resulting Date object with toISOString() (UTC) and toString() (local).
Instead of counting digits and doing the division and multiplication by hand, check it with our tool.
Detects the digit count automatically and instantly computes seconds, milliseconds, microseconds, nanoseconds, and both UTC and local time. It's free, and everything runs in your browser.

Common points of confusion
Values that point to the same moment show a different digit count depending on the unit. Below is a table of the numbers we just verified.
| Digits | Unit | Example value | Moment it points to (UTC) |
|---|---|---|---|
| 1–11 digits | seconds | 1784298258 | 2026-07-17 14:24:18 |
| 12–14 digits | milliseconds | 1784298258087 | 2026-07-17 14:24:18.087 |
| 15–17 digits | microseconds | 1784298258087000 | 2026-07-17 14:24:18.087 (same moment) |
| 18+ digits | nanoseconds | 1784298258087000000 | 2026-07-17 14:24:18.087 (same moment) |
UTC vs. local time, and how relative time works
UTC and local time look different because the timestamp itself is an absolute value that belongs to no time zone (the time elapsed since midnight on January 1, 1970 UTC). Local time is that absolute value plus whatever time zone offset the browser is set to.
For example, the values in the table above are 14:24 on July 17 in UTC, but in Korea Standard Time (UTC+9) the same moment displays as 23:24 on July 17.
Relative time (a label like "in 3 hours") is calculated by taking the difference between the target time and the current time in seconds, then converting it into minutes, hours, or days — whichever is easiest to read. If the target is in the future you get "in ~", and if it's in the past you get "~ ago."
Negative timestamps and derived sub-second units
Negative timestamps are valid too. A negative value means a moment before midnight on January 1, 1970 (UTC). For example, -3600 points to 23:00 on December 31, 1969 (UTC), which is 3600 seconds (one hour) before that reference point.
One last thing to keep in mind: microsecond and nanosecond values are calculated by multiplying the milliseconds value by 1000 and 1,000,000 respectively. If the originating system actually measured down to microseconds on its own, the trailing digits of that original value may differ from this calculated one.
The short version
- A digit count of 1–11 means seconds, 12–14 means milliseconds, 15–17 means microseconds, and 18 or more means nanoseconds.
- Even the largest 11-digit seconds value only reaches 5138 AD, so 12 digits or more is unlikely to be seconds.
- Passing a 10-digit seconds value into the milliseconds slot lands you near the 1970s, and mistaking a 13-digit milliseconds value for seconds and multiplying by 1000 throws you into an absurd future.
- The same timestamp displays differently in UTC and in local time by the time zone offset, and negative values mean a moment before 1970.
- Microsecond and nanosecond values are calculated by multiplying the milliseconds value.
Detects the digit count automatically and instantly computes seconds, milliseconds, microseconds, nanoseconds, and both UTC and local time. It's free, and everything runs in your browser.
Frequently asked questions
Can I always be sure of the unit from the digit rule alone?
For real-world timestamps near the present day, the rule is more than enough. But it's a conventional heuristic based on the fact that a seconds value reaches 5138 AD in 11 digits. A seconds value pointing far enough into the future could run to 12 digits or more, and the rule would break down.
Can I enter negative timestamps?
Yes. Negative values representing dates before January 1, 1970 calculate normally. For example, -3600 means 23:00 on December 31, 1969 (UTC).
Is the number I enter sent to a server?
No. All unit detection and date calculation run instantly in JavaScript inside your browser, and the number you enter is never sent to a server.
Are the microsecond and nanosecond values as precise as real measurements?
No. The microsecond and nanosecond values shown are calculated by multiplying the milliseconds value by 1000 and 1,000,000. If the originating system actually measured independently down to microseconds, the trailing digits of that value may differ.
This article was adapted from our Korean original. Read the Korean original