# setMonth method

The `setMonth` method allows you to change the month value of the date object. It takes the month as the first parameter and the day of the month as the second optional parameter.

## Syntax

`date.setMonth(month, [day]);`

## Example

Let's set the month for the current date:

`let date = new Date(); date.setMonth(1); console.log(date);`

## Example

Let's set the month and day for the current date:

`let date = new Date(); date.setMonth(1, 25); console.log(date);`

## See also

- the `setFullYear` method
  that sets the year
- the `setDate` method
  that sets the day of the month
- the `setHours` method
  that sets the hours
- the `setMinutes` method
  that sets the minutes
- the `setSeconds` method
  that sets the seconds
- the `setMilliseconds` method
  that sets the milliseconds

← →
↑
en ru