setMonth

Modified on Tue, 22 Aug 2023

Description

Use this function to set the month to the given date.

Syntax

setMonth(date, month)

Returns

Return ValueDescription
DateReturn the resulting date.

Sample

ExampleResultDescription
setMonth(2023-04-09, 11)Sets the month to November (since November is the 11th month of the year).

To view all the Date functions, click here.

See Also