English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript setMinutes() method

 JavaScript Date Object

setMinutes()Method to set the minutes of the date object.

This method can also be used to set seconds and milliseconds.

If the specified parameter is out of the expected range, thensetMinutes() willtry to update the date information in the Date object accordingly.

For example, if you will100 is used asseconds(seconds)value, then the minute will increase1(minute value+ 1),while40 will be used for seconds, that is1Minutes40 seconds.

Syntax:

date.setMinutes(minutes, seconds, millisec)
var d = new Date();
d.setMinutes(32);
Test and see‹/›

If not specifiedsecondsandmillisecparameter, the value returned from the getSeconds() and getMilliseconds() methods will be used.

Browser Compatibility

All browsers fully support the setMinutes() method:

Method
setMinutes()IsIsIsIsIs

Parameter Value

ParameterDescription
minutes(Required) 0 to59integer, representing minutes
seconds(Optional) 0 to59integer, representing seconds
millisec(Optional) 0 to999numbers, representing milliseconds

Technical Details

Return Value:1970 Year1Month1Milliseconds between 00:00:00 UTC and the update date
JavaScript Version:ECMAScript 1

 JavaScript Date Object