ID: 49981
Updated by: [email protected]
Reported By: shokarta at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: WinXP SP2/AppServ2.5.9
PHP Version: 5.2SVN-2009-10-24 (snap)
New Comment:
Check your timezone. Always use gmdate() to not get such surprises.
There is no bug here.
Previous Comments:
------------------------------------------------------------------------
[2009-10-24 00:40:50] shokarta at gmail dot com
can make it works like this:
$actual_week = date("Y\WW",1319281200);
$real_result = strtotime("this monday",strtotime($actual_week));
but its only for this specific error
------------------------------------------------------------------------
[2009-10-24 00:20:30] shokarta at gmail dot com
Description:
------------
Got a timestamp for sunday 1319281200 (its Sunday 23.10.2011),
date("W")
says its 42nd week of the year.
if i do strtotime("this monday",1319281200) then it will return:
1319367600 which is monday 24.10.2011 and date("W") says its 43rd week
on that year..
so simply strtotime works that sunday is a first day in a week instead
of date which makes monday as a first day...
can i configure strtotime to work on monday as a first day as well?
Reproduce code:
---------------
strtotime("this monday",1319281200);
Expected result:
----------------
1318762800 (week 42, monday, 17/10/2011)
Actual result:
--------------
1319367600 (week 43, sunday, 24/10/2011)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49981&edit=1