check date format with regex yyy/mm/dd code example
Example 1: regex for date mm/dd/yyyy
function validateDate(testdate) {
var date_regex = /^\d{2}\/\d{2}\/\d{4}$/ ;
return date_regex.test(testdate);
}
Example 2: regex for yyyy-mm-dd
^\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])$