#29946 [Opn->Bgs]: date('r', strtotime('day ago')) always returns 00:00:00 time for last day
| From: | derick@php.net | Date: | Thu, 02 Sep 2004 09:00:23 +0000 |
| Subject: | #29946 [Opn->Bgs]: date('r', strtotime('day ago')) always returns 00:00:00 time for last day | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-65620@lists.php.net to get a copy of this message | ||
ID: 29946
Updated by: derick@php.net
Reported By: zukker at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: RH 9.1, WinXP
PHP Version: 5.0.1
New Comment:
Duplicate of http://bugs.php.net/bug.php?id=28209.
Previous Comments:
------------------------------------------------------------------------
[2004-09-02 10:49:57] zukker at gmail dot com
Description:
------------
I notified that code like
echo date('r', strtotime('1 day ago'));
always returns 00:00:00 time for last day, but if I use code
echo date('r', mktime(date('h'), date('i'), date('s'),
date('m'),
date('d') - 1, date('Y')));
it returns date representation with a correct time, exactly one day
ago.
Why it always returns midnight time for last day?
If I use '24 hours ago' or '84600 seconds ago' - I got the same wrong
time of midnight.
Reproduce code:
---------------
echo date('r', mktime(date('h'), date('i'), date('s'),
date('m'),
date('d') - 1, date('Y'))), '<br />';
echo date('r', strtotime('1 day ago')), '<br />';
echo date('r', strtotime('24 hours ago')), '<br />';
echo date('r', strtotime('86400 seconds ago')), '<br />';
Expected result:
----------------
Wed, 1 Sep 2004 12:48:54 +0400
Wed, 1 Sep 2004 12:48:54 +0400
Wed, 1 Sep 2004 12:48:54 +0400
Wed, 1 Sep 2004 12:48:54 +0400
Actual result:
--------------
Wed, 1 Sep 2004 12:48:54 +0400
Wed, 1 Sep 2004 00:00:00 +0400
Wed, 1 Sep 2004 00:00:00 +0400
Wed, 1 Sep 2004 00:00:00 +0400
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29946&edit=1