JS根据年月获得当月天数的实现代码


function getDaysInMonth(year,month){ 
month = parseInt(month,10); //parseInt(number,type)这个函数后面如果不跟第2个参数来表示进制的话,默认是10进制。 
var temp = new Date(year,month,0); 
return temp.getDate(); 
}

« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3