Javascript Date get number of seconds since the Epoch

Description

Javascript Date get number of seconds since the Epoch

let seconds = Math.floor(Date.now() / 1000)
console.log(seconds);

Note

The code uses Math.floor() not Math.round() since it return the actual second passed.




PreviousNext

Related