Code
function daysInMonth(iMonth, iYear)
{
return 32 - new Date(iYear, iMonth, 32).getDate();
}
<button onclick="alert(daysInMonth(1, 2100));">February 2100</button>
<button onclick="alert(daysInMonth(1, 2005));">February 2005</button>
<button onclick="alert(daysInMonth(1, 2004));">February 2004</button>
<button onclick="alert(daysInMonth(1, 2003));">February 2003</button>
<button onclick="alert(daysInMonth(1, 2001));">February 2001</button>
<button onclick="alert(daysInMonth(1, 2000));">February 2000</button>
<button onclick="alert(daysInMonth(1, 1999));">February 1999</button>
