Timestamp in JavaScript

How to work with timestamp JavaScript — getting the current Unix timestamp and converting between timestamps and dates in JavaScript.

Timestamp Converter

--
--
--
--
--

Convert seconds to human time

--
--

Current Timestamp in JavaScript

Math.floor(Date.now()/1000)     // seconds
Date.now()                       // milliseconds

Timestamp to Date in JavaScript

new Date(1700000000*1000).toISOString()   // UTC
new Date(1700000000*1000).toLocaleString() // local

Date to Timestamp in JavaScript

Math.floor(new Date('2023-11-14T22:13:20Z').getTime()/1000)

Home · Timestamp Python · Unix Timestamp