JavaScript Date setUTCMonth() methodThe JavaScript date setUTCMonth() method is used to set the integer value that represents the month in the specified date on the basis of universal time. The setUTCMonth() method value starts with 0 that represents January. SyntaxThe setUTCMonth() method is represented by the following syntax: ParametermonthValue - It represents an integer value between 0 and 11 specifying the month. dayValue - It is optional. It represents an integer value between 1 and 31 specifying the day of the month. JavaScript Date setUTCMonth() method exampleHere, we will understand setUTCMonth() method through various examples. Example 1Let's see an example to print current and updated month. Test it NowOutput: Current month : 8 Updated month : 9 Example 2Let's see an example to update the month of the given date. Test it NowOutput: 11 Example 3In this example, we will also specify the particular day with the month. Test it NowOutput: Updated month : 12 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