Date.setUTCMonth() (Method)

Sets the UTC month number of the time object.

Availability:

ECMAScript edition - 2
JavaScript - 1.3
JScript - 3.0
Internet Explorer - 4.0
Netscape - 4.0
Property/method value type:Time value
JavaScript syntax:-myDate.setUTCMonth(aMonthValue)
-myDate.setUTCMonth(aMonthValue, aDateValue)
Argument list:aDateValueAn optional value in days of the month
aMonthValueA value between 0 and 11 in months

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

The computations are carried out in UTC time coordinates.

ECMA mandates that the date should be an optional argument. If the date value is omitted, the value is provided internally as if the getUTCDate() method had been called to provide it.

Example code:

   <HTML>

   <HEAD></HEAD>

   <BODY>

   <SCRIPT>

   myArray = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");

   myDate  = new Date();

   myDate.setUTCDate(4);

   myDate.setUTCMonth(6);

   document.write("The fourth of July this year is a " + myArray[myDate.getDay()]);

   </SCRIPT>

   </BODY>

   </HTML>

See also:Date.getMonth(), Date.getUTCMonth(), Date.prototype, Date.setMonth()

Cross-references:

ECMA 262 edition 2 - section - 15.9.5.35

ECMA 262 edition 3 - section - 15.9.5.39