Unix Timestamp Digits: How to Tell Seconds from Milliseconds

PublishedToolEpoch Precision Converter (Seconds to Nanoseconds)

Contents
  1. Why mix-ups over digit counts actually happen in real work
  2. How to work it out yourself by counting digits, no tool needed
  3. Common points of confusion
  4. The short version
  5. Frequently asked questions

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.

  1. Count the digits in the number.
  2. Pick the unit using the digit rule (the 11 / 14 / 17 digit boundaries).
  3. 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.
  4. 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.

Epoch Precision Converter (Seconds to Nanoseconds)

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.

DigitsUnitExample valueMoment it points to (UTC)
1–11 digitsseconds17842982582026-07-17 14:24:18
12–14 digitsmilliseconds17842982580872026-07-17 14:24:18.087
15–17 digitsmicroseconds17842982580870002026-07-17 14:24:18.087 (same moment)
18+ digitsnanoseconds17842982580870000002026-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.
Epoch Precision Converter (Seconds to Nanoseconds)

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

Related articles

  1. US Cup vs Korean Cup: Convert Cups, Tbsp, and Tsp to mLA US cup holds 236.59 mL, not the 200 mL Korean cup. See the fixed gallon ratios and how to convert cups, tablespoons, and teaspoons to milliliters.
  2. US Restaurant Tip Calculator: Tip, Total, and Per-Person SplitSee how US restaurant tips are calculated: tip amount, total with tip, and per-person split, with default rates by country. Enter your own bill to check.
  3. US Paycheck Calculator: Take-Home Pay After 3 Taxes (2026)See how federal income tax, FICA, and state tax shape your take-home pay, with a $75,000 salary example, 2026 and 2027 IRS tables, and a free calculator.
  4. US Restaurant Tip Calculator: Pre-Tax vs Post-Tax TipsSee how a US receipt adds subtotal, tax, and tip, and how much your per-person total changes when the tip is based on the pre-tax or post-tax amount.
  5. UV Index Scale and Safe Sun Exposure Time CalculatorHow the WHO UV index scale, Fitzpatrick skin type, SPF, hats and shade combine to estimate your actual UV exposure and how long until your skin burns.
  6. VAT Calculation: Why 10% of the Total Is WrongSee why multiplying a VAT-inclusive total by 10% gives the wrong tax, and how to split a total back into net amount and VAT by dividing by 1.1.

Related tools