[Solved] PHP regular expression matching date [duplicate]


<?php

$date="2009/10/22";

if ( preg_match('/^(?:(19[0-9]{2}|20[0-9]{2}))\/(0[1-9]|1[012])\/(0[1-9]|[12][0-9]|3[01])$/', $date ) ) {

    echo $date , ' is a valid date format.';

} else {

    echo $date , ' is not a valid date format!';

}

?>

Also please make sure you use checkdate() function in addition to this.

1

solved PHP regular expression matching date [duplicate]