Hi guys. Some folks helped me on http://stackoverflow.com/questions/3326316/how-to-check-the-data-format-in-php post but I need to check two date formats MM-DD-YYYY and DD-MM-YY instead of one. Do I need to setup two regular expression???? Thanks for the help!!!
$date1=05/25/2010;
$date2=25/05/10; //I wish both of them would pass
$date_regex = '!^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d$!';
if (preg_match($date_regex, $date1)) {
do something
}
if (preg_match($date_regex, $date2)) { // need second Reg. expression??
do something
}