Get a timestamp in #JavaScript

On almost all current browsers you can use Date.now() to get the UTC timestamp in milliseconds;
To get the timestamp in seconds, you can use:

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



> Date.now()
1608669466244
> Math.floor(Date.now() / 1000)
1608669474

Comments