note 70189 added to function.checkdate
| From: | minterior at gmail dot com | Date: | Fri, 06 Oct 2006 10:03:51 +0000 |
| Subject: | note 70189 added to function.checkdate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118117@lists.php.net to get a copy of this message | ||
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);
}
?>
----
Server IP: 130.206.1.5
Probable Submitter: 80.35.133.91
----
Manual Page -- http://www.php.net/manual/en/function.checkdate.php
Edit -- https://master.php.net/note/edit/70189
Del: integrated -- https://master.php.net/note/delete/70189/integrated
Del: useless -- https://master.php.net/note/delete/70189/useless
Del: bad code -- https://master.php.net/note/delete/70189/bad+code
Del: spam -- https://master.php.net/note/delete/70189/spam
Del: non-english -- https://master.php.net/note/delete/70189/non-english
Del: in docs -- https://master.php.net/note/delete/70189/in+docs
Del: other reasons-- https://master.php.net/note/delete/70189
Reject -- https://master.php.net/note/reject/70189
Search -- https://master.php.net/manage/user-notes.php