JS gets the code for the number of days of the month according to the year

  • 2020-03-30 03:30:41
  • OfStack


function getDaysInMonth(year,month){ 
month = parseInt(month,10); //ParseInt (number,type) defaults to base 10 if it is not followed by a second argument.
var temp = new Date(year,month,0); 
return temp.getDate(); 
}

Related articles: