|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-01-09 22:35 UTC] mail at piotrantosik dot com
Description:
------------
DateTime object return non exist day in calendar.
Test script:
---------------
$d = new \DateTime('2014-01-08');
$d->modify('-8 day');
Expected result:
----------------
echo $d->format('Y-m-d')) //2013-12-30
Actual result:
--------------
echo $d->format('Y-m-d')) //2013-12-31
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 01:00:02 2025 UTC |
You're right, arithmetic is correct but 31-12-2013 is not exist in any calendars. Eg. i need display a week from this day: $d->format('W') return 01 - but maybe throw a exception? why return 01??