note 94014 deleted from datetime.setdate by danielc
| From: | danielc@php.net | Date: | Sat, 24 Apr 2010 20:34:08 +0000 |
| Subject: | note 94014 deleted from datetime.setdate by danielc | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168597@lists.php.net to get a copy of this message | ||
Note Submitter: melicerte at mailinator dot com
----
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.