#29946 [NEW]: date('r', strtotime('day ago')) always returns 00:00:00 time for last day
| From: | zukker at gmail dot com | Date: | Thu, 02 Sep 2004 08:49:58 +0000 |
| Subject: | #29946 [NEW]: date('r', strtotime('day ago')) always returns 00:00:00 time for last day | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-65619@lists.php.net to get a copy of this message | ||
From: zukker at gmail dot com
Operating system: RH 9.1, WinXP
PHP version: 5.0.1
PHP Bug Type: Date/time related
Bug description: date('r', strtotime('day ago')) always returns 00:00:00 time
for last day
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 bug report at http://bugs.php.net/?id=29946&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29946&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=29946&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=29946&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=29946&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29946&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29946&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29946&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29946&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29946&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29946&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29946&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29946&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29946&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29946&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29946&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29946&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29946&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29946&r=float