function fanDayByYearMonth(year,month) {
switch (month) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
return 31;
break;
case 2:
return isRunYear(year) ? 29 : 28;
break;
case 4:
case 6:
case 9:
case 11:
return 30;
break;
}
}
//被四整除(不被100整除)的是闰年,其中可以被100整除的同时必须被400整除的才是闰年,其余的就是平年
function isRunYear(year) {
if (year % 4 == 0) {
if (year % 100 ) {
if (year % 400 == 0) {
return true;
}else{
return false;
}
}
return true;
}else{
return false;
}
}
function isRunYears(year) {
return year%4== 0? (year%100 == 0? (year%400==0? true:false) :true) : false;
}
网友评论