Bug #60340 [Com]: DateTime. The problem of determining the relative dates, by the command last
Edit report at https://bugs.php.net/bug.php?id=60340&edit=1 ID: 60340 Comment by: marcingronowski at gmail dot com Reported by:marcingronowski at gmail dot com Summary:DateTime. The problem of determining the relative dates, by the command last Status: Bogus Type: Bug Package:Date/time related Operating System: Windows PHP Version:5.3.8 Block user comment: N Private report: N New Comment: @ sala...@php.net You're right. I'm sorry. It's my fault. Previous Comments: [2011-11-19 21:33:39] sala...@php.net You aren't testing "first/last day of", you're testing "first/last day" which simply moves the date defined by the absolute parts forward/backward by one day. The same applies to your "last monday" test, which should be "last monday of". All of these behaviours are documented. -------------------- [2011-11-19 18:58:22] marcingronowski at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=60340&edit=1
[PHP-BUG] Bug #60340 [NEW]: DateTime. The problem of determining the relative dates, by the command last
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