Edit report at https://bugs.php.net/bug.php?id=53158&edit=1

 ID:                 53158
 Updated by:         der...@php.net
 Reported by:        s...@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] der...@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] s...@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

Reply via email to