JavaScript
DategetWeeksInMonth Method
Syntax
Date.getWeeksInMonth()
Returns
- weeksnumber
The total weeks in the month.
Description
Extension to the native date variable to the get the total number of weeks in the month a given date is in. The first of the month will always be in the first week regardless of how many subsequent days are in the same week.
Example
var d = new Date(2018,7,10); var w = d.getWeeksInMonth(); // w = 5