乐趣区

关于javascript:根据年月判断总共天数和判断周次

// 依据年月判断总共天数
      getDaysInMonth(year, month) {month = parseInt(month, 10); 
         var temp = new Date(year, month, 0);
         return temp.getDate();},
// 依据年月日判断周次
     getWeek(year,month,day){month = parseInt(month, 10);         
        day = parseInt(day, 10); 
        let week = new Date(year+"/"+month+"/"+day).getDay();
        return week
     }
     //week:0=> 周日     
     //week:1=> 周一
     //week:2=> 周二
     //week:3=> 周三     
     //week:4=> 周四
     //week:5=> 周五     
     //week:6=> 周六


退出移动版