note 70189 deleted from function.checkdate by bjori
| From: | bjori@php.net | Date: | Wed, 11 Oct 2006 08:26:48 +0000 |
| Subject: | note 70189 deleted from function.checkdate by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-118399@lists.php.net to get a copy of this message | ||
Note Submitter: minterior at gmail dot com
----
Like charon said, checkdate only accept int WITHOUT a leading 0 (zero), and date function returns a
string. A little improve to orgutus function is converting date result into int, to be sure
checkdate gets int parameters:
<?php
function datetime_check_date_string($date_string) {
$ts = strtotime($date_string);
$d = intval(date('d', $ts));
$m = intval(date('m', $ts));
$y = intval(date('y', $ts));
return checkdate($m, $d, $y);
}
?>