DateObj is a valid Date object created using Date() constructor in which we want to set the month. Value of month is from 0 to 11 because the total number of months in a year is 12 from January to December. Value 0 is used for January, 1 for February and so on till 11 for December.
Parameter: Here parameter is month_Value i.e, the value of month which is used to set in date() constructor.
Return Values: It returns the new i.e updated month which is set by setUTCMonth() function.
Errors and Exceptions
11 1 2018
Here 11 is the new month of December, 1 is the current date and 2018 is the current year according to universal time.
Here 3 is the new month of April and year becomes 1997 from 1996 because month range is form 0 to 11 i.e, total 12 and we set new month as 3 which increase year by one to 1997 from 1996 and month becomes 3 according to universal time.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.