note 51956 deleted from function.strtotime by derick

From: Date: Sun, 15 Jul 2007 12:49:21 +0000
Subject: note 51956 deleted from function.strtotime by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-128586@lists.php.net to get a copy of this message
Note Submitter: thraoln at yahoo dot com ---- Quick solution to strtotime() function returning wrong results(for PHP4 and below) when it tries to "guess what you meant" and will successfully parse dates that would otherwise be considered invalid...just dont use it, this works better: function valid_date($thedate) { list($year, $month, $day) = sscanf($thedate, "%d-%d-%d"); return checkdate($month, $day, $year); } "2005-11-25" returns TRUE "2005-11-32" returns FALSE

« previous php.notes (#128586) next »