Bug #64181 [Opn->Dup]: Incorrect value for DateTime "this week" start

From: Date: Sun, 07 Aug 2016 09:29:08 +0000
Subject: Bug #64181 [Opn->Dup]: Incorrect value for DateTime "this week" start
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203025@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64181&edit=1 ID: 64181 Updated by: cmb@php.net Reported by: grey2k at gmail dot com Summary: Incorrect value for DateTime "this week" start -Status: Open +Status: Duplicate Type: Bug Package: Date/time related Operating System: Linux and Windows PHP Version: 5.3.21 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: > I think that this is a duplicate of bug #63740. Indeed, it is. Previous Comments: ------------------------------------------------------------------------ [2013-02-11 17:34:54] timakeeling at gmail dot com I think that this is a duplicate of bug #63740. https://bugs.php.net/bug.php?id=63740 ------------------------------------------------------------------------ [2013-02-09 23:50:11] grey2k at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=64181&edit=1

« previous php.bugs (#203025) next »