#36912 [Asn->Bgs]: strtotime subtracting months

From: Date: Wed, 29 Mar 2006 14:24:45 +0000
Subject: #36912 [Asn->Bgs]: strtotime subtracting months
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95082@lists.php.net to get a copy of this message
ID: 36912 Updated by: derick@php.net Reported By: epilepticfridgeboy at hotmail dot com -Status: Assigned +Status: Bogus Bug Type: Date/time related Operating System: debian PHP Version: 5.1.2 Assigned To: derick New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php . Previous Comments: ------------------------------------------------------------------------ [2006-03-29 13:35:17] epilepticfridgeboy at hotmail dot com Description: ------------ Subtracting a month using strtotime does not always subtract a month. Reproduce code: --------------- <?php print date('Y-m-d', strtotime('-1 month')); ?> Expected result: ---------------- Assuming the code is run on 2006-03-29, I would expect the result to be 2006-02-28, which is one month ago. Actual result: -------------- 2006-03-01 This is not one month ago. This has been reported as a bug before but marked as "Bogus" - no idea how not subtracting one month from a date correctly is bogus... and I wasn't allowed to add this to the notes system in the manual to warn others about this odd behaviour., so here it is again as a bug report. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36912&edit=1

« previous php.bugs (#95082) next »