获取月份对应的day

1    function getDaysInMonth(month, year) {
2         var daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];      //主要处理二月份的天数  
3         if ((month == 1) && (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0))) {
4             return 29;
5         } else {
6             return daysInMonth[month];
7         }
8     }

// 闰年的判定方法
  判定公历闰年遵循的规律为: 四年一闰,百年不闰,四百年再闰.
   公历闰年的简单计算方法:(符合以下条件之一的年份即为闰年)
   1.能被4整除而不能被100整除。(如2100年就不是闰年)
   2.能被400整除。(如2000年是闰年)
原文地址:https://www.cnblogs.com/mushishi/p/3161959.html