setMinutes method
The setMinutes method allows you
to change the number of minutes for the
date object.
It takes the number of minutes as the
first parameter, it can also take seconds
and milliseconds as the second and third
optional parameters.
Syntax
date.setMinutes(minutes, [seconds], [milliseconds]);
Example
Let's set the minutes for the current time:
let date = new Date();
date.setDate(59);
console.log(date);
Example
Let's set the minutes and seconds for the current point in time:
let date = new Date();
date.setDate(59, 59);
console.log(date);
See also
-
the
setHoursmethod
that sets the hours -
the
setSecondsmethod
that sets the seconds -
the
setMillisecondsmethod
that sets the milliseconds