Edit report at https://bugs.php.net/bug.php?id=63929&edit=1

 ID:                 63929
 Comment by:         daniz at rocketmaik 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:

Indeed you're assumption is correct.
Reading the info regarding the 'o' gives meening why I'm seeing what I'm seeing.

Thanks


Previous Comments:
------------------------------------------------------------------------
[2013-01-07 12:43:06] r07271368 at hotmail dot com

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

------------------------------------------------------------------------
[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

Reply via email to