ID: 30042 Updated by: [EMAIL PROTECTED] Reported By: jorge at newsengin dot com -Status: Assigned +Status: Closed Bug Type: Date/time related Operating System: OS X Panther PHP Version: 5.0.1 Assigned To: derick New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2004-09-10 09:16:43] [EMAIL PROTECTED] I think it's the same bug after all, will add it to my list. ------------------------------------------------------------------------ [2004-09-09 21:24:15] jorge at newsengin dot com Description: ------------ This seems related to the open bug involving "now" resetting to midnight of the current day, but it's not identical. If you try to adjust a time by passing strtotime() an offset like "+2 hours", you get that offset relative to midnight. In other words, strtotime("+2 hours", $unixtimestamp) returns a timestamp for 2 a.m, of the day referenced by $unixtimestamp, or of the current day if the second argument is omitted. Reproduce code: --------------- // in PHP 4, this correctly returns 3:30 p.m. on Jan 1, 2005 but in PHP 5.0.1 returns 2:00 a.m. on Jan 1, 2005: $timeStamp = strtotime("+2 hours", strtotime("1/1/2005 1:30pm")); echo date("r", $timeStamp); // in PHP 4, this correctly returns a date/time for two hours from now, but in PHP 5.0.1 it returns 2 a.m. on the current day: $timeStamp = strtotime("+2 hours"); echo date("r", $timeStamp); Expected result: ---------------- two hours from given date and time or from now, depending on whether a second timestamp argument was provided to strtotime(); Actual result: -------------- 2 a.m. on relevant date. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30042&edit=1