note 9543 deleted from function.checkdate by jimw
| From: | jimw@php.net | Date: | Fri, 07 Dec 2001 20:38:24 +0000 |
| Subject: | note 9543 deleted from function.checkdate by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-21942@lists.php.net to get a copy of this message | ||
Let's assume You have to check a YYYY-MM-DD fromat date, you can do it perfectly with using
both checkdate and a little regexp just to make sure the format is correct, here it is ($ndate is
the new date):
$aux = explode ("-", $ndate);
if ((!checkdate ($aux[1],$aux[2],$aux[0]))||(!ereg("^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$",
$ndate)))
{ echo "bad date<br>\n"; };