标签:config color conf turn val arw func == valueof
// 获取本年度第几周 var getYearWeek = function(a, b, c) { var date1 = new Date(a, parseInt(b) - 1, c), date2 = new Date(a, 0, 1), d = Math.round((date1.valueOf() - date2.valueOf()) / 86400000); return Math.ceil((d + ((date2.getDay() + 1) - 1)) / 7); }; getYearWeek(2019,08,15)
// 获取本月第几周 var getMonthWeek = function (a, b, c) { var date = new Date(a, parseInt(b) - 1, c), w = date.getDay(), d = date.getDate(); if(w==0){ w=7; } var config={ getMonth:date.getMonth()+1, getYear:date.getFullYear(), getWeek:Math.ceil((d + 6 - w) / 7), } return config; }; var getDate=getMonthWeek(2019,08,15); console.log("今天是 " + getDate.getYear + " 年的第 "+ getDate.getMonth + " 月的第 " + getDate.getWeek + " 周");
标签:config color conf turn val arw func == valueof
原文地址:https://www.cnblogs.com/kewenxin/p/11357622.html