|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63392 DateTime::modify() start of week inconsistency
Submitted: 2012-10-30 02:26 UTC Modified: 2016-08-07 09:32 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: chris at cmbuckley dot co dot uk Assigned: derick (profile)
Status: Duplicate Package: Date/time related
PHP Version: 5.4Git-2012-10-30 (snap) OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: chris at cmbuckley dot co dot uk
New email:
PHP Version: OS:


 [2012-10-30 02:26 UTC] chris at cmbuckley dot co dot uk
Calling $dt->modify("Monday this week") for all dates 13–19 May 2012 (Sun–Sat) 
result in the same date (2012-05-14), suggesting that "this week" runs Sun–Sat. 
However, calling $dt->modify("Sunday this week") gives the "next" Sunday (2012-
05-20) for the same range.

On a related note, the documentation on relative date formats is lacking on the 
behaviour of this and strtotime when used with locales; one might expect the 
start of the week to be interpreted from LC_TIME.

Test script:

$dt = new DateTime("2012-05-13");
$dt->modify("Sunday this week");

Expected result:
string(31) "Sun, 13 May 2012 00:00:00 +0000"

Actual result:
string(31) "Sun, 20 May 2012 00:00:00 +0000"


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-24 11:17 UTC]
-Assigned To: +Assigned To: derick
 [2012-11-24 11:17 UTC]
See also PR
 [2016-08-07 09:32 UTC]
-Status: Assigned +Status: Duplicate
 [2016-08-07 09:32 UTC]
This is actually a duplicate of bug #63740, which has been fixed
as of PHP 5.6.23 and 7.0.8, respectively (see
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Oct 24 19:03:33 2021 UTC