蔡勒公式计算今天周几

var dayOfTheWeek = function(day, month, year) {

  if (month == 1) {

    month = 13;

    year--;

    }

    if (month == 2) {

    month = 14;

    year--;

    }

    let week = (day + 2 * month + 3 * Math.floor((month + 1) / 5) + year + Math.floor(year / 4)  -Math.floor(year / 100)  +Math.floor(year / 400) ) % 7;

    return week;

};

tips

 如果还不清楚或者想交个朋友的同学可以微信联系我:qq981145483(备注:csdn algo)

发布了57 篇原创文章 · 获赞 5 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq_33807889/article/details/102573967