0

In Javascript, how to get the weekNumber in a month for a given date. week should start from monday.

I tried this

var firstDay = new Date(this.getFullYear(), this.getMonth(), 1).getDay();
return Math.ceil((this.getDate() + firstDay)/7);

but could not get the exact week number when the month does not starts with monday.

Thanks all

Vinay
  • 11
  • 3
  • Look here maybe it's helpfull http://stackoverflow.com/questions/2483719/get-weeks-in-month-through-javascript – Sybren May 24 '15 at 07:06
  • Sorry sybren, Im actually looking for the week number in a month for the given date. (i.e) 24th May,2015 is 3rd week in May. Week starting for monday – Vinay May 24 '15 at 07:17
  • Does this help? http://stackoverflow.com/questions/3280323/get-week-of-the-month – sobolevn May 24 '15 at 07:36
  • check this out http://wiki.secondlife.com/wiki/Day_of_the_Week – webduvet May 24 '15 at 07:50
  • Not actually. Im looking for the week count with monday as start day – Vinay May 24 '15 at 15:20

0 Answers0