getWeeksInMonth

Modified on Tue, 22 Aug 2023

Description

Use this function to get the number of calendar weeks a month spans.

Syntax

getWeeksInMonth(date, options)

Returns

Return ValueDescription
NumberReturns the number of calendar weeks a month spans.

Sample

ExampleResultDescription
getWeeksInMonth(2023-04-01, weekStartsOn: 1)5There are 5 calendar weeks in the month of April 2023.

To view all the Date functions, click here.

See Also