标签:
function shu(year,month,date){
var isRunnian = ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 ===0);
var rules = [
31,
isRunnian ? 29 : 28,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31
];
for(var i = 0,result = 0; i < month - 1; ++i) {
result = result + rules[i];
}
result = result + date;
console.log(result);
}
shu(2016,3,1);
标签:
原文地址:http://www.cnblogs.com/thelucky/p/5589516.html