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

javascriptdate.setMinutes(minutes, [seconds], [milliseconds]);

Example

Let's set the minutes for the current time:

javascriptlet date = new Date();
date.setDate(59);

console.log(date);

Example

Let's set the minutes and seconds for the current point in time:

javascriptlet date = new Date();
date.setDate(59, 59);

console.log(date);

See also