here is my date check javascript.
function leapyearcheck(year)
{
if(year.value % 4 != 0)
{
return 0;
}
else
{
if(year.value % 100 != 0)
{
return 1; //leap year
}
else
{
if(year.value % 400 != 0)
{
return 0
}
else
return 1; //leap year
}
}
}
function datecheck(day,month,year) //call this function
{
//alert(day.value);
if(!leapyearcheck(year))
{
//alert("Not Leap Year");
if(month.value == 2)
{
if(day.value > 28)
{
alert("Check the Day and Month");
return false;
}
}
}
else
{
//alert("Leap Year");
if(month.value == 2)
{
if(day.value > 29)
{
alert("Check the Day and Month");
return false;
}
}
}
Thanks to HasinHyder for a tricky one..
var dt = new Date(year+"/02/29");
if (dt.getMonth()=="1")
alert (year + " is a leap year");
else
alert(year + " is not a leap year")