Validating date in Java Script
There are lots of method available which uses REG EXP to validate date and are bit complicated to understand. Here is simple and small date validator.
function isValidDate(day, month, year){
var date;
//Get a Date object based on the given day, month and year
//months start at 0 (0-11 instead of 1-12)
date = new Date(year,month-1,day);
return ((day == date.getDate()) && (month == (date.getMonth()+1))
&& (year == date.getFullYear()));
}
November 29, 2007 | Filed Under Javascript
Related Post
Comments
Leave a Reply