#49981 [Bgs]: strtotime work on sunday as a first day of week
ID: 49981 User updated by: shokarta at gmail dot com Reported By: shokarta at gmail dot com Status: Bogus Bug Type: Date/time related Operating System: WinXP SP2/AppServ2.5.9 PHP Version: 5.2SVN-2009-10-24 (snap) New Comment: for example try this: use date 1st of April 2009 (its wednesday). echo date(j.m.Y,strtotime(last Monday,strtotime(04/01/2009))); // RESULT is 30.03.2009 (should be 23.03.2009) echo date(j.m.Y,strtotime(this Monday,strtotime(04/01/2009))); // RESULT is 06.04.2009 (should be 30.04.2009) echo date(j.m.Y,strtotime(next Monday,strtotime(04/01/2009))); // RESULT is 06.04.2009 (should be 06.04.2009) - CORRECT just found out that this doesnt work or works only as itself wants. if i accidently jump on timestamp which stands for any Monday, then last Monday should show 1 week ago, this monday should show this day, next monday should show 1 week later! but it wont show like this! another example: $month_min = strtotime(2009-01-01); for($i=0; $i12; $i++) { $month = strtotime(+$i months,$month_min); $month = strtotime(last Monday,$month); } echo date(d.m.Y,$month).br; } unset($i); once u load the page then change code from last Monday to this Monday and once you reload only some of them will change! (and sometimes when you cange it back to last Monday and reload again then some of the others will change even when they didnt change before! still not a bug? Previous Comments: [2009-10-24 21:03:19] sni...@php.net Check your timezone. Always use gmdate() to not get such surprises. There is no bug here. [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=49981edit=1
#49981 [NEW]: strtotime work on sunday as a first day of week
From: shokarta at gmail dot com Operating system: WinXP SP2/AppServ2.5.9 PHP version: 5.2SVN-2009-10-24 (snap) PHP Bug Type: Date/time related Bug description: strtotime work on sunday as a first day of week 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 bug report at http://bugs.php.net/?id=49981edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49981r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49981r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49981r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49981r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49981r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49981r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49981r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49981r=needscript Try newer version: http://bugs.php.net/fix.php?id=49981r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49981r=support Expected behavior: http://bugs.php.net/fix.php?id=49981r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49981r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49981r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49981r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49981r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=49981r=dst IIS Stability: http://bugs.php.net/fix.php?id=49981r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49981r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49981r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49981r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49981r=mysqlcfg
#49981 [Opn]: strtotime work on sunday as a first day of week
ID: 49981 User updated by: shokarta at gmail dot com Reported By: shokarta at gmail dot com Status: Open Bug Type: Date/time related Operating System: WinXP SP2/AppServ2.5.9 PHP Version: 5.2SVN-2009-10-24 (snap) New Comment: 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 Previous Comments: [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=49981edit=1