The JavaScript date.setutcfullyear () method will be the specified date for the whole year according to the Universal Time.
Grammar
Date.setutcfullyear (yearvalue[, monthvalue[, Dayvalue])
Note: The data inside and outside the brackets is optional
The following are the details of the parameters:
- Yearvalue: An integer that specifies the numeric value of the year, for example, 2008 years.
- Monthvalue: A month from 0 to 11 of integers, from January to December.
- An integer dayvalue:1 to 31 that represents the day of the month. If you specify the Dayvalue parameter, you must also specify Monthvalue.
If you do not specify Monthvalue and Dayvalue parameters, the values returned from the GetMonth and GetDate methods are used. If the specified parameter is outside the expected range, call setUTCFullYear the other parameters that you are trying to update and the date information for the dates object. For example, if you specify 15 for Monthvalue, the year is incremented by 1 (year + 1), and 3 is used to represent the month.
return Value:
Example:
This will produce the following results: