Description
The setMonth() method sets the month (from 0 to 11), according to local time.
This method has the form:
Date.setMonth(month,day)
Parameter | Description |
---|---|
month | (required) An integer between 0 and 11 representing the month |
day | (optional) An integer between 1 and 31 representing the day |
Examples
The following example shows the basic use of this method.
<script>
var d = new Date();
d.setMonth(11);
document.write(d);
</script>
This produces the following result:
Browser Support
Firefox | IE | Chrome | Opera | Safari |
---|---|---|---|---|