Home  >  Article  >  Web Front-end  >  JS根据年月获得当月天数的实现代码_javascript技巧

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

WBOY
WBOYOriginal
2016-05-16 16:42:351097browse
function getDaysInMonth(year,month){ 
month = parseInt(month,10); //parseInt(number,type)这个函数后面如果不跟第2个参数来表示进制的话,默认是10进制。 
var temp = new Date(year,month,0); 
return temp.getDate(); 
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn