JavaScript Date setUTCFullYear() methodThe JavaScript date setUTCFullYear() method is used to set the year for the specified date on the basis of universal time. SyntaxThe setUTCFullYear() method is represented by the following syntax: ParameteryearValue - It represents an integer value specifying the year. monthValue - It is optional. It represents an integer value between 0 and 11 specifying the month. dateValue - It is optional. It represents an integer value between 1 and 31 specifying the day of the month. JavaScript Date setUTCFullYear() method exampleHere, we will understand setUTCFullYear() method through various examples. Example 1Let's see an example to print the value of current and updated year. Test it NowOutput: Current year : 2018 Updated year : 2019 Example 2Let's see an example to update a year of the given date. Test it NowOutput: Updated year : 2018 Example 3In this example, we will also specify the particular month with the year. Test it NowOutput: Updated year : 2019 Next TopicJavaScript Date |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India