JavaScript Date setMonth()
JavaScript Date setMonth()
The setMonth() method is used for setting the month of a date object. It can also be used to set the day of the month. In this, 0 is January, 1 is February, and so on.
Syntax:-
Its syntax is:- Date.setMonth(month, day)
Return:-
Its return is:- number of milliseconds of new date from 1 January, 1970
Further Explanation:-
Parameter | Description |
---|---|
month | Required. An integer representing the month from 0-11. |
day | Optional. An integer representing the day of the month from 1 - 31. |