Home  >  Article  >  Web Front-end  >  JS implementation code to obtain the number of days of the month based on the year and month_javascript skills

JS implementation code to obtain the number of days of the month based on the year and month_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:42:351207browse
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