Date.setMinutes() (Method)

Sets the minutes of the time object.

Availability:

ECMAScript edition - 2
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Netscape Enterprise Server - 2.0
Opera - 3.0
Property/method value type:Time value
JavaScript syntax:-myDate.setMinutes(aMinutesValue)
-myDate.setMinutes(aMinutesValue, aSecondsValue)
-myDate.setMinutes(aMinutesValue, aSecondsValue, aMillisecondsValue)
Argument list:aMillisecondsValueAn optional value between 0 and 999 milliseconds
aMinutesValueA value between 0 and 59 minutes
aSecondsValueAn optional value between 0 and 59 seconds

The computation is done according to local time coordinates.

ECMA mandates that the seconds and milliseconds should be optional arguments. If the milliseconds value is omitted, the current milliseconds value is used as if the value had been supplied with a getMilliseconds() method. Likewise, the seconds value behaves as if it had been supplied by a getSeconds() method, if it is missing.

The result of this method is the new time value of the containing object having been adjusted by the values passed in as arguments.

Example code:

   <HTML>

   <HEAD></HEAD>

   <BODY>

   <SCRIPT>

   myDate = new Date();

   myDate.setMilliseconds(0);

   myDate.setSeconds(0);

   myDate.setMinutes(0);

   myTime = myDate.getTime();

   document.write("The time rounded down to the nearest hour is "  + myTime + " Milliseconds");

   </SCRIPT>

   </BODY>

   </HTML>

See also:Date.getMinutes(), Date.prototype, Date.setUTCMinutes()

Cross-references:

ECMA 262 edition 2 - section - 15.9.5.28

ECMA 262 edition 3 - section - 15.9.5.32