Hi,

this regex isn't perfect at all but might do the job. You should
modify the pattern to match the year part against 2037 as a maximum
and also don't forget to checkdate().

<?php

    $date = '30/03/2983 12:00';
    $pattern = '[0-3][0-9]/[0|1][0-9]/[1|2][0-9]{3,3}\s[0-2][0-9]:[0-5][0-9]';
    if (preg_match("!^$pattern$!", $date) === 1) {
        echo 'date is in valid form';
    }
    else {
        echo 'date form is invalid';
    }

?>

Hope it helps,

Balazs

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to