Bug #60340 [NEW]: DateTime. The problem of determining the relative dates, by the command last

From: Date: Sat, 19 Nov 2011 18:58:23 +0000
Subject: Bug #60340 [NEW]: DateTime. The problem of determining the relative dates, by the command last
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-165365@lists.php.net to get a copy of this message
From: Operating system: Windows PHP version: 5.3.8 Package: Date/time related Bug Type: Bug Bug description:DateTime. The problem of determining the relative dates, by the command last Description: ------------ Incorrect data is generated by function DateTime::__construct in case of using the relative definition of time. If you use the command "last day of month" the previous month will be returned. If you use the command "first day of month" the correct month will be returned and second day in the month will be returned. Test script: --------------- $datea = new DateTime('last day October 2011'); echo $datea->format('Y-F-d'); $dateb = new DateTime('last monday October 2011'); echo $dateb->format('Y-F-d'); $datec = new DateTime('first day October 2011'); echo $datec->format('Y-F-d'); $datec = new DateTime('first day November 2011'); echo $datec->format('Y-F-d'); Expected result: ---------------- 2011-October-30 2011-October-30 2011-October-01 2011-November-01 Actual result: -------------- 2011-September-30 2011-September-26 2011-October-02 2011-November-02 -- Edit bug report at https://bugs.php.net/bug.php?id=60340&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60340&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60340&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60340&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60340&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60340&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60340&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60340&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60340&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60340&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60340&r=support Expected behavior: https://bugs.php.net/fix.php?id=60340&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60340&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60340&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60340&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60340&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60340&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60340&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60340&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60340&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60340&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60340&r=mysqlcfg

« previous php.bugs (#165365) next »