i want to get total number of weeks from date
Get Weeks In Month Through Javascript
this was the post i referred for my problem.
function weekCount(year, month_number) {
// month_number is in the range 1..12
var firstOfMonth = new Date(year, month_number-1, 1);
var lastOfMonth = new Date(year, month_number, 0);
var used = firstOfMonth.getDay() + lastOfMonth.getDate();
return Math.ceil( used / 7);
}
for above code i just found bug. week starts on monday. bt above code i think considers from sunday. so its giving error for june 2014 month. function returns 5 bt actual weeks are 6. can anyone help me ?