Bug #53158 [Com]: strtotime('next monday') resets the time to 00:00
Edit report at http://bugs.php.net/bug.php?id=53158&edit=1
ID: 53158
Comment by: tomas dot brastavicius at quantum dot lt
Reported by: seld@php.net
Summary: strtotime('next monday') resets the time to 00:00
Status: Assigned
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:
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'));
Previous Comments:
------------------------------------------------------------------------
[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 http://bugs.php.net/bug.php?id=53158&edit=1
Thread (4 messages)