Bug #63929 [Com]: wrong year in strtotime

From: Date: Mon, 07 Jan 2013 12:43:06 +0000
Subject: Bug #63929 [Com]: wrong year in strtotime
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-175817@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63929&edit=1 ID: 63929 Comment by: r07271368 at hotmail dot com Reported by: daniz at rocketmail dot com Summary: wrong year in strtotime Status: Open Type: Bug Package: Date/time related PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Please try this: $date = "2013-01-07"; $earlier = strtotime("-1 week", strtotime($date)); // should result in 31 Dec 2012, which is a Monday echo date('r', $earlier); // to make sure we have the right date echo "\n"; echo date('W Y', $earlier); // what you have echo "\n"; echo date('W o', $earlier); // what I think you want echo "\n"; I ran it and got this: Mon, 31 Dec 2012 00:00:00 +0000 01 2012 01 2013 Previous Comments: ------------------------------------------------------------------------ [2013-01-07 10:21:46] daniz at rocketmail dot com Description: ------------ Year is wrong in result based on test. Test script: --------------- $date = "2013-01-07"; echo date('W Y', strtotime("-1 week", strtotime($date))); Expected result: ---------------- Should be "01 2013" Actual result: -------------- Result is "01 2012" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63929&edit=1

« previous php.bugs (#175817) next »