setDate Method (Date) (JavaScript)
Sets the numeric day-of-the-month value of the Date object using local time.
dateObj.setDate(numDate)
To set the day-of-the-month value using Universal Coordinated Time (UTC), use the setUTCDate method.
If the value of numDate is greater than the number of days in the month, the date rolls over to a later month and/or year. For example, if the stored date is January 5, 1996 and setDate(32) is called, the date changes to February 1, 1996. If numDate is a negative number, the date rolls back to an earlier month and/or year. For example, if the stored date is January 5, 1996 and setDate(-32) is called, the date changes to November 29, 1995.
The setFullYear Method (Date) (JavaScript) can be used to set the year, month, and day of the month.
Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards. Also supported in Windows Store apps. See Version Information.
Applies To: Date Object (JavaScript)