From:             grey2k at gmail dot com
Operating system: Linux and Windows
PHP version:      5.3.21
Package:          Date/time related
Bug Type:         Bug
Bug description:Incorrect value for DateTime "this week" start

Description:
------------
the problem is:

in sunday code output date for Monday next week

$date = new DateTime();
$date->setTimezone(new DateTimeZone('Europe/Moscow'));
$date->setTimestamp(strtotime('Monday this week'));

echo $date->format("d.m.Y"); 

but in other days (except Sunday) its return correct value of Monday.

I ever set locale manualy , which has a monday - the first day of week, but
PHP "think" the Sunday is still firs day. is it bug ?? or i do some wrong
?

for check this you need to set you local time in any Sunday.

Test script:
---------------
$date = new DateTime();
$date->setTimezone(new DateTimeZone('Europe/Moscow'));
$date->setTimestamp(strtotime('Monday this week'));

echo $date->format("d.m.Y");

Expected result:
----------------
The value on this week Monday.

for example in Sunday of 10.02.2012 i expect to see 04.02.2012. 



Actual result:
--------------
if i test this code at Sunday 10.02.2012 - actual result is 11.02.2012 

- it's wrong because this is a next week

-- 
Edit bug report at https://bugs.php.net/bug.php?id=64181&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64181&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64181&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=64181&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64181&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64181&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64181&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64181&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64181&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64181&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64181&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=64181&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=64181&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64181&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64181&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64181&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64181&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64181&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64181&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64181&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64181&r=mysqlcfg

Reply via email to