Bug #66988 [NEW]: Modifying a time -1 month from the end of the month has unexpected results

From: Date: Mon, 31 Mar 2014 15:53:11 +0000
Subject: Bug #66988 [NEW]: Modifying a time -1 month from the end of the month has unexpected results
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184985@lists.php.net to get a copy of this message
From: jglw at live dot co dot uk Operating system: Windows 7 PHP version: 5.4.26 Package: Date/time related Bug Type: Bug Bug description:Modifying a time -1 month from the end of the month has unexpected results Description: ------------ If you modify a time -1 month from the last day of a month it seems to interpret that as take away the number of days from the previous month. It would make more sense that if you modified a time by -1 month it wouldn't fall into the same month from which you modified it. Test script: --------------- <?php $time = strtotime("2014-03-31 -1 month"); echo date("Y-m-d", $time); ?> Expected result: ---------------- 2014-02-28 Actual result: -------------- 2014-03-03 -- Edit bug report at https://bugs.php.net/bug.php?id=66988&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66988&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66988&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66988&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=66988&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=66988&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=66988&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=66988&r=needscript Try newer version: https://bugs.php.net/fix.php?id=66988&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=66988&r=support Expected behavior: https://bugs.php.net/fix.php?id=66988&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=66988&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=66988&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=66988&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66988&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=66988&r=dst IIS Stability: https://bugs.php.net/fix.php?id=66988&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=66988&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=66988&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=66988&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=66988&r=mysqlcfg

« previous php.bugs (#184985) next »