note 108674 added to function.date-create
| From: | php at andysdrawings dot co dot uk | Date: | Wed, 16 May 2012 15:22:01 +0000 |
| Subject: | note 108674 added to function.date-create | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188018@lists.php.net to get a copy of this message | ||
DateTime will recognise any number up to 12 as a [month], and any number up to 31 as a [day]; it
calculates the resulting date to be [day] days after the start of [month]. This means that when a
datetime object is created with more days than are found in that month, the date will be beyond the
end of the month.
<?php
$test = new DateTime('02/31/2011');
echo date_format($test, 'Y-m-d H:i:s'); // 2011-03-03 00:00:00
$test = new DateTime('06/31/2011');
echo date_format($test, 'Y-m-d H:i:s'); // 2011-07-01 00:00:00
?>
----
Server IP: 69.147.83.197
Probable Submitter: 82.6.77.238
----
Manual Page -- http://www.php.net/manual/en/function.date-create.php
Edit -- https://master.php.net/note/edit/108674
Del: integrated -- https://master.php.net/note/delete/108674/integrated
Del: useless -- https://master.php.net/note/delete/108674/useless
Del: bad code -- https://master.php.net/note/delete/108674/bad+code
Del: spam -- https://master.php.net/note/delete/108674/spam
Del: non-english -- https://master.php.net/note/delete/108674/non-english
Del: in docs -- https://master.php.net/note/delete/108674/in+docs
Del: other reasons-- https://master.php.net/note/delete/108674
Reject -- https://master.php.net/note/reject/108674
Search -- https://master.php.net/manage/user-notes.php