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 (profile)
Status: Duplicate Package: Date/time related
PHP Version: 5.6.3 OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: derick@php.net
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 13:01:26 2024 UTC