note 94014 added to datetime.setdate
| From: | melicerte at mailinator dot com | Date: | Mon, 12 Oct 2009 12:12:01 +0000 |
| Subject: | note 94014 added to datetime.setdate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-161648@lists.php.net to get a copy of this message | ||
Please note that DateTime:setDate() accepts out-of-range values without warnings.
EG:
<?php
date_default_timezone_set('Europe/London');
$datetime = new DateTime('2008-08-03 14:52:10');
$datetime->setDate(2008, 13, 12);
?>
will reset the DateTime object's date to now. The best approach is to make a wrapper to
setDate() which do check for out-of-range values.
----
Server IP: 192.41.40.227
Probable Submitter: 194.183.232.18
----
Manual Page -- http://www.php.net/manual/en/datetime.setdate.php
Edit -- https://master.php.net/note/edit/94014
Del: integrated -- https://master.php.net/note/delete/94014/integrated
Del: useless -- https://master.php.net/note/delete/94014/useless
Del: bad code -- https://master.php.net/note/delete/94014/bad+code
Del: spam -- https://master.php.net/note/delete/94014/spam
Del: non-english -- https://master.php.net/note/delete/94014/non-english
Del: in docs -- https://master.php.net/note/delete/94014/in+docs
Del: other reasons-- https://master.php.net/note/delete/94014
Reject -- https://master.php.net/note/reject/94014
Search -- https://master.php.net/manage/user-notes.php