plain/devtools home

Unix timestamp: seconds or milliseconds?

Count the digits. A 10 digit number like 1700000000 is seconds; a 13 digit number like 1700000000000 is milliseconds. Both mean 2023-11-14T22:13:20.000Z.

Last reviewed 2026-11-04.

timestamp-convertersamplesCtrl↵ run · s sample

Read as

never leaves your browser

Worked example

Paste 1700000000 into the converter above with the unit on seconds, then paste 1700000000000 with the unit on milliseconds. Both give 2023-11-14T22:13:20.000Z. If you pick the wrong unit, the date is wildly wrong: 1700000000000 read as seconds is a date tens of thousands of years from now.

The digit rule

Seconds are 10 digits from 2001-09-09T01:46:40.000Z (1,000,000,000) until 2286-11-20T17:46:40.000Z (10,000,000,000). Milliseconds are 13 digits across the same period. The rule holds for any date between those two moments, which covers everything you will meet today. Microseconds are 16 digits and nanoseconds 19.

Which languages use which

LanguageCallUnit
JavaScriptDate.now()milliseconds
Pythontime.time()seconds (float)
Gotime.Now().Unix()seconds (UnixMilli() for ms)
JavaSystem.currentTimeMillis()milliseconds
PostgreSQLextract(epoch from now())seconds (float)
MySQLUNIX_TIMESTAMP()seconds

Common mistakes

  • Sending JavaScript milliseconds to an API that expects seconds, such as the JWT exp claim.
  • Dividing by 1000 with integer math in the wrong place and losing the fractional second.
  • Mixing local time and UTC. A timestamp has no zone; only the display does.

More on conversions: timestamps in JS, Python, Go and SQL.

Running this on a server

Store timestamps in UTC on the server and convert on display. The hosting guide compares where to run a small API that does it.

Frequently asked questions

How do I know if a timestamp is in milliseconds?

It has 13 digits for any date from September 2001 to November 2286. Seconds have 10.

What is the epoch?

1970-01-01T00:00:00Z, the zero point of Unix time.

How do I convert milliseconds to seconds?

Divide by 1000. In JavaScript use Math.floor(Date.now() / 1000).

Sources

Related

esc
↑↓ move↵ open? all shortcuts

Keyboard shortcuts

Cmd or Ctrl shortcuts always work.
Everywhere
Everywhere
Open the command palette
CtrlK
Open the palette (outside a text field)
/
Show these shortcuts
?
Toggle light and dark theme
t
Go home
gh
Go to all tools
gt
On a tool page
On a tool page
Run the main action
Ctrl↵
Copy the output
c
Load the next sample
s
Focus the input
i
Leave a text field
Esc
Previous or next tool
[]
In the palette
In the palette
Move the selection
↑↓
Open the selected item
↵
Close
Esc