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