Bug #53158 [Asn->Bgs]: strtotime('next monday') resets the time to 00:00
| From: | derick@php.net | Date: | Tue, 06 Dec 2011 06:15:28 +0000 |
| Subject: | Bug #53158 [Asn->Bgs]: strtotime('next monday') resets the time to 00:00 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165684@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=53158&edit=1
ID: 53158
Updated by: derick@php.net
Reported by: seld@php.net
Summary: strtotime('next monday') resets the time to 00:00
-Status: Assigned
+Status: Bogus
Type: Bug
Package: Date/time related
Operating System: All
PHP Version: 5.3.3
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
Duplicate of #54909
Previous Comments:
------------------------------------------------------------------------
[2011-03-01 19:26:06] derick@php.net
There is a reason for this... can't remember it now. I don't think it's a
"bug"... but will investigate at some point.
------------------------------------------------------------------------
[2011-03-01 18:57:13] tomas dot brastavicius at quantum dot lt
These also reset time:
echo date('Y-m-d H:i:s', strtotime('+1 monday')) . "\n";
echo date('Y-m-d H:i:s', strtotime('first monday')) . "\n";
echo date('Y-m-d H:i:s', strtotime('first monday of March 2011'));
------------------------------------------------------------------------
[2010-10-25 22:15:02] seld@php.net
Description:
------------
strtotime() should not reset the time unless specified, "next monday" does reset the time
to 00:00, while "next week" does not.
Test script:
---------------
var_dump(strtotime('next monday'));
var_dump(strtotime('next week'));
var_dump(date('Y-m-d H:i:s', strtotime('next monday')));
var_dump(date('Y-m-d H:i:s', strtotime('next week')));
Expected result:
----------------
int 1288641482
int 1288641482
string '2010-11-01 19:58:02' (length=19)
string '2010-11-01 19:58:02' (length=19)
Actual result:
--------------
int 1288569600
int 1288641482
string '2010-11-01 00:00:00' (length=19)
string '2010-11-01 19:58:02' (length=19)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=53158&edit=1