|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64181 Incorrect value for DateTime "this week" start
Submitted: 2013-02-09 23:50 UTC Modified: 2016-08-07 09:29 UTC
Avg. Score:4.5 ± 1.0
Reproduced:18 of 18 (100.0%)
Same Version:6 (33.3%)
Same OS:12 (66.7%)
From: grey2k at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: Date/time related
PHP Version: 5.3.21 OS: Linux and Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
30 + 35 = ?
Subscribe to this entry?

 [2013-02-09 23:50 UTC] grey2k at gmail dot com
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-11 17:34 UTC] timakeeling at gmail dot com
I think that this is a duplicate of bug #63740.
 [2016-08-07 09:29 UTC]
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2016-08-07 09:29 UTC]
> I think that this is a duplicate of bug #63740.

Indeed, it is.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 07:01:34 2024 UTC