Date.setDate() (Method)

Sets the day number within a month 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.setDate(aDateValue)
Argument list:aDateValueA day number within the current month

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

The calculations are performed according to local time coordinates.

Example code:

   <HTML>
   <HEAD>
   </HEAD>
   <BODY>
   <SCRIPT>
   myArray = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
   myDate = new Date();
   myDate.setDate(1);
   document.write("The first day of this month is a " + myArray[myDate.getDay()]);
   </SCRIPT>
   </BODY>
   </HTML>

See also:Date.getDate(), Date.prototype

Cross-references:

ECMA 262 edition 2 - section - 15.9.5.32

ECMA 262 edition 3 - section - 15.9.5.36