Bug #68973 [NEW]: DateTime('first day of last week') not working

From: Date: Mon, 02 Feb 2015 16:42:06 +0000
Subject: Bug #68973 [NEW]: DateTime('first day of last week') not working
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190413@lists.php.net to get a copy of this message
From: t dot baumgarden at web dot de Operating system: centOS PHP version: 5.5.21 Package: Date/time related Bug Type: Bug Bug description:DateTime('first day of last week') not working Description: ------------ Today is 2015-02-02 (02.February) I want first and last day ob last week: $date = new DateTime('first day of last week'); echo $date->format('Y-m-d'); // --- $date = new DateTime('last day of last week'); echo $date->format('Y-m-d'); result is (WRONG!): 2015-02-01 2015-02-28 MUST BE: 2015-01-26 2015-02-01 This working fine with "month" instead "week": DateTime('first day of last month'); DateTime('last day of last month'); result is: 2015-01-01 2015-01-31 Test script: --------------- $date = new DateTime('first day of last week'); echo $date->format('Y-m-d'); $date = new DateTime('last day of last week'); echo $date->format('Y-m-d'); Expected result: ---------------- 2015-01-26 2015-02-01 Actual result: -------------- 2015-02-01 2015-02-28 -- Edit bug report at https://bugs.php.net/bug.php?id=68973&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68973&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68973&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68973&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=68973&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=68973&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=68973&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=68973&r=needscript Try newer version: https://bugs.php.net/fix.php?id=68973&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=68973&r=support Expected behavior: https://bugs.php.net/fix.php?id=68973&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=68973&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=68973&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=68973&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68973&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=68973&r=dst IIS Stability: https://bugs.php.net/fix.php?id=68973&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=68973&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=68973&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=68973&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=68973&r=mysqlcfg

« previous php.bugs (#190413) next »