OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Get Weeks In Month Through Javascript

  • Thread starter Thread starter Stephen Watkins
  • Start date Start date
S

Stephen Watkins

Guest
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:

Code:
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.

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

<p>I need this to be able to know how many rows I need for a given month.</p>

<p>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).</p>

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

<pre><code>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
</code></pre>

<p>Thanks for all the help.</p>
 
Top