Bug #64181 [Com]: Incorrect value for DateTime "this week" start
| From: | timakeeling at gmail dot com | Date: | Mon, 11 Feb 2013 17:34:54 +0000 |
| Subject: | Bug #64181 [Com]: Incorrect value for DateTime "this week" start | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176565@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
Comment by: timakeeling at gmail dot com
Reported by: grey2k at gmail dot com
Summary: Incorrect value for DateTime "this week" start
Status: Open
Type: Bug
Package: Date/time related
Operating System: Linux and Windows
PHP Version: 5.3.21
Block user comment: N
Private report: N
New Comment:
I think that this is a duplicate of bug #63740.
https://bugs.php.net/bug.php?id=63740
Previous Comments:
------------------------------------------------------------------------
[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