日期:2014-05-16 浏览次数:20532 次
var f = function (y, m) { var i = 1, w = 0, d2 = 0; var d = new Date(y, m - 1, i); while (d.getMonth() === m - 1) { if (d.getDay() !== 0 && d.getDay() !== 6) { ++d2; } d = new Date(y, m - 1, ++i); } echo(Math.ceil(d2 / 5)); }; for (var m = 0; m < 12; m++) { f(2012, m + 1); }