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);
时间: 2024-10-15 10:47:41