From http://www.w3schools.com (Copyright Refsnes Data)
JavaScript Date Object
The setFullYear() method is used to set the year.
| dateObject.setFullYear(year,month,day) |
| Parameter | Description |
|---|---|
| year | Required. A four-digit value representing the year |
| month | Optional. A numeric value between 0 and 11 representing the month |
| day | Optional. A numeric value between 1 and 31 representing the date |
Note: This method is always used in conjunction with a Date object.
Example 1Set the year to 1992:
The output of the code above will be: Try it yourself » |
Example 2Set the date to November 3, 1992:
The output of the code above will be: Try it yourself » |
JavaScript Date Object
From http://www.w3schools.com (Copyright Refsnes Data)