Standard built-ins
Date.prototype.setUTCMonth()
Set UTC month and optional day. With day omitted, existing day may overflow into following month.
Formal Syntax & Structure
javascript syntaxjavascript
date.setUTCMonth(month, [date])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| month | Number | UTC month index. |
| date | Number | Optional UTC day. |
Return Value
Number
New timestamp or NaN.
Working Example
Example Snippetjavascript
const d=new Date("2024-01-31T00:00:00Z");d.setUTCMonth(1);console.log(d.toISOString());