Skip to main content
edited tags
Link
Joe Doyle
  • 6.4k
  • 3
  • 45
  • 45
added 148 characters in body; added 270 characters in body
Source Link
Stephen Watkins
  • 25.9k
  • 17
  • 71
  • 102

In Javascript, how do I get the number of weeks in a month? I can't seem to find code for this anywhere.

I need this to be able to know how many rows I need for a given month.

To be more specific, I would like the number of weeks that have at least one day in the week (a week being defined as starting on Sunday and ending on Saturday).

So, for something like this, I would want to know it has 5 weeks:

S M T W R F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 

Thanks for all the help.

In Javascript, how do I get the number of weeks in a month? I can't seem to find code for this anywhere.

I need this to be able to know how many rows I need for a given month.

Thanks for all the help.

In Javascript, how do I get the number of weeks in a month? I can't seem to find code for this anywhere.

I need this to be able to know how many rows I need for a given month.

To be more specific, I would like the number of weeks that have at least one day in the week (a week being defined as starting on Sunday and ending on Saturday).

So, for something like this, I would want to know it has 5 weeks:

S M T W R F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 

Thanks for all the help.

Source Link
Stephen Watkins
  • 25.9k
  • 17
  • 71
  • 102

Get Weeks In Month Through Javascript

In Javascript, how do I get the number of weeks in a month? I can't seem to find code for this anywhere.

I need this to be able to know how many rows I need for a given month.

Thanks for all the help.