php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68603 "Monday this week" works (wrongly) on Sunday starting weeks.
Submitted: 2014-12-14 11:29 UTC Modified: 2016-08-07 09:39 UTC
Votes:4
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:1 (25.0%)
From: derick@php.net Assigned: cmb
Status: Duplicate Package: Date/time related
PHP Version: 5.6.3 OS: *
Private report: No CVE-ID:
 [2014-12-14 11:29 UTC] derick@php.net
Description:
------------
The note at http://php.net/manual/en/function.strtotime.php#105344 describes:

We can now do thing like this with strtotime:
<?php
$weekMondayTime = strtotime('Monday this week');
?>
However this works based on a week starting Sunday.  I do not know if we can tweak this PHP behavior, anyone know?

But it really should use Monday starting weeks.

Test script:
---------------
<?php
$weekMondayTime = strtotime('Monday this week');
echo date('Y-m-d h:i:s', $weekMondayTime), "\n";
?> 


Expected result:
----------------
2014-12-08 12:00:00


Actual result:
--------------
2014-12-15 12:00:00


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-07 09:39 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2016-08-07 09:39 UTC] cmb@php.net
This is actually a duplicate of bug #63740, which has been fixed
as of PHP 5.6.23 and 7.0.8, respectively (see
<https://3v4l.org/7P9Dr>).
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Thu May 25 16:01:43 2017 UTC