ID: 35983
User updated by: tim at komta dot com
Reported By: tim at komta dot com
Status: Bogus
Bug Type: Date/time related
Operating System: Windows XP Pro, Server 2003
PHP Version: 5.1.2
Assigned To: derick
New Comment:
That's quite unfortunate that this is the newly intended behavior, both
in the inadequate documentation and the actual breaking from prior
behavior. For such a major change, I really feel that the
documentation of the function should have been updated to reflect
this.
I rely (relied, I guess) on this to work for expanding to ranges...when
my users search for "yesterday" they really meant "yesterday 00:00:00
through yesterday 23:59:59" which was easily handled by using different
relative points in the day. This new behavior completely breaks my
search engine, and as of now, I don't see any way to fix this, short of
having my users type in a more explicit date range they want.
I'm not sure that I see the inconsistancy. "yesterday", relative to a
timestamp, should return a timestamp that's 24 hours less than the
timestamp given. I see it as far more inconsistant that it could be
anywhere from 24 hours less to 47:59:59 less.
Previous Comments:
------------------------------------------------------------------------
[2006-01-13 12:01:50] [EMAIL PROTECTED]
This is proper behavior. In the past PHP has been inconsistent
regarding different terms like this. With the new code in PHP 5.1 this
all works the same. What you want to do is by using:
"-1 day" or "1 day ago".
------------------------------------------------------------------------
[2006-01-13 09:15:00] [EMAIL PROTECTED]
Assigned to the date man.
------------------------------------------------------------------------
[2006-01-12 19:51:13] tim at komta dot com
Description:
------------
Prior to PHP 5.1.2 (potentially earlier, just only noticed it)
strtotime(), when used with the optional 'now' argument, would return
the time using the full 'now'. Now it returns 00:00 on the date of the
'now', ignoring hours, minutes, and seconds.
Reproduce code:
---------------
$this_morning = strtotime('today 00:00:00');
$tonight = strtotime('today 23:59:59');
echo date('m/d Hi', strtotime('yesterday', $this_morning)).'<br/>';
echo date('m/d Hi', strtotime('yesterday', $tonight)).'<br/>';
Expected result:
----------------
(as of 2005-01-12):
01/11 0000
01/11 2359
Actual result:
--------------
(as of 2005-01-12):
01/11 0000
01/11 0000
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35983&edit=1