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

0次阅读

共计 342 个字符,预计需要花费 1 分钟才能阅读完成。

// 依据年月判断总共天数
      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=> 周六


正文完
 0