//Get the last day of a certain month
function getLastDay(year,month) {
var new_year = year; //Take the current year
var new_month = month++;//Pick the first day of the next month for easy calculation (the last day is not fixed)
if(month>12) {
new_month -=12; // Month reduction
new_year++;
}
var new_date = new Date(new_year,new_month,1); �
return (new Date(new_date.getTime()-1000*60*60*24)).getDate();//Get the last day date of the month
}