Javascript Date setSeconds(seconds) sets the date's seconds.
dateObj.setSeconds(secondsValue[, msValue])
secondsValue
- An integer between 0 and 59, representing the seconds.msValue
- Optional. A number between 0 and 999, representing the milliseconds.The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date.
If a parameter is outside of the expected range, setSeconds()
updates the date accordingly.
Setting the seconds to a number greater than 59 also increments the minutes.
Get the date for '70 seconds after now':
let date = new Date(); date.setSeconds(date.getSeconds() + 70); console.log( date ); // shows the correct date