Sets the numeric day-of-the-month value of the Date object using local time.
SyntaxdateObj.setDate( numDate )
The following example shows how to use the setDate method.
var date = new Date("12/15/1990");
date.setDate(30);
document.write(date);
Remarks
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) can be used to set the year, month, and day of the month.
See also Other articles AttributionsMicrosoft Developer Network: Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4