#43169 [Opn->Bgs]: Wrong date using strtotime('-1 month')

From: Date: Thu, 01 Nov 2007 12:39:51 +0000
Subject: #43169 [Opn->Bgs]: Wrong date using strtotime('-1 month')
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-119198@lists.php.net to get a copy of this message
ID: 43169 Updated by: derick@php.net Reported By: php at dredzik dot pl -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Windows XP SP/2 PHP Version: 5.2.4 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 2007-10-31 -1 month = 2007-09-31, which turns into 2007-10-01. Previous Comments: ------------------------------------------------------------------------ [2007-11-01 12:37:43] php at dredzik dot pl There was very similiar bug to this one reported over 2 years ago, but since no one seems to have found a solution, I'm resubmitting just to remind you about it. ------------------------------------------------------------------------ [2007-11-01 12:29:07] php at dredzik dot pl Description: ------------ I use this code to generate timestamp for current and last month and everything worked fine until yesterday (31 October 2007). Today everything came back to normal - but when I set the date to yesterday on my system it keeps getting back. Reproduce code: --------------- echo date('Y-m', strtotime('now')) . "\n"; echo date('Y-m', strtotime('-1 month')); Expected result: ---------------- 2007-10 2007-09 Actual result: -------------- 2007-10 2007-10 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43169&edit=1

« previous php.bugs (#119198) next »