Possible Duplicate:
how to validate date with PHP
Hi there,
I have a script which checks the date passed to it in this format YYYY-MM-DD and validates it, however it seems to be invalidating users who are under 20 whereas I'd prefer it to be under 18...I am not too familiar with ereg...could you please advise me on how to change this script to validate over 18's?
function valid_date( $fecha )
{
// VALID FORMAT = yyyy-mm-dd
if (@ereg ("([0-9]{4})-([0-9]{2})-([0-9]{2})", $fecha, $fecha_array))
{
// VALID DATE IN CALENDAR
return ( checkdate($fecha_array[2],$fecha_array[3],$fecha_array[1]) )
? true
: false ;
}
return false;
}
Thanks.