JavaScript计算某月1号是星期几 计算某年某月有多少天

//计算某月1号是星期几
var getWeekInMonth = function(year, month) {
return new Date(year + ‘/’ + month + ‘/’ + ’01’).getDay();
}
//计算某年某月有多少天
var isLeapYear = function(a) {
return a % 400 == 0 || a % 4 == 0 && a % 100 != 0
}
var getDaysInMonth = function(a, b) {
return [null, 31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][b] || (isLeapYear(a) ? 29 : 28)
};

转载于:https://www.cnblogs.com/miumiu316/p/7210731.html

    原文作者:weixin_30898109
    原文地址: https://blog.csdn.net/weixin_30898109/article/details/95104294
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞