javascript thread: Date Validation
function testDate(nDay, nMonth, nYear)
{
var dtEvent = new Date();
dtEvent.setFullYear(nYear, nMonth, nDay) ;
if(dtEvent.getYear() == nYear
&& dtEvent.getMonth() == nMonth
&& dtEvent.getDate() == nDay)
{
return true;
}
else
{
return false ;
}
}
take care that testDate(29,01,1999) returns false
indeed you have to understant it like 1 month AND 29 days so
this the date 29th February 1999 which doesn't exist...
you can change the format as you like by reversing the parameters..or else
|





