getMonth

Modified on Tue, 22 Aug 2023

Description

Use this function to get the month of the given date.

Syntax

getMonth(date)

Returns

Return ValueDescription
NumberReturns the month of the given date.

Sample

ExampleResultDescription
getMonth(2023-04-08)4The function extracts the month from the date and returns it, which is 4 (April).

To view all the Date functions, click here.

See Also