#24927 [Opn->Bgs]: strtotime 'next' failure

From: Date: Sun, 03 Aug 2003 22:58:58 +0000
Subject: #24927 [Opn->Bgs]: strtotime 'next' failure
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-45275@lists.php.net to get a copy of this message
ID: 24927 Updated by: iliaa@php.net Reported By: joergleu at hotmail dot com -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Windows XP, Linux Suse 8.2 PHP Version: 4.3.3RC2 New Comment: Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Because of this, we hope you add your comments to the existing bug instead. Thank you for your interest in PHP. Duplicate of bug #18670, #22814 Previous Comments: ------------------------------------------------------------------------ [2003-08-03 17:49:57] joergleu at hotmail dot com Description: ------------ I found an failure in the strtotime function. When I used the function strtotime ('next hour/day/week/...') then the result I expected was wrong (The result is one greater). The similiar function call strtotime('last ...') works correctly. In PHP Version 4.2.2 (Linux) works the function correctly. Reproduce code: --------------- $now = mktime(12,0,0,8,1,2003); print $now . ', ' . strftime('%A %d. %B %Y - %H:%M:%S', $now); print strtotime('last hour', $now) . ', ' . strftime('%A %d. %B %Y - %H:%M:%S', strtotime('last hour', $now)); print strtotime('next hour', $now) . ', ' . strftime('%A %d. %B %Y - %H:%M:%S', strtotime('next hour', $now)); print strtotime('last day', $now) . ', ' . strftime('%A %d. %B %Y - %H:%M:%S', strtotime('last day', $now)); print strtotime('next day', $now) . ', ' . strftime('%A %d. %B %Y - %H:%M:%S', strtotime('next day', $now)); print strtotime('last week', $now) . ', ' . strftime('%A %d. %B %Y - %H:%M:%S', strtotime('last week', $now)); print strtotime('next week', $now) . ', ' . strftime('%A %d. %B %Y - %H:%M:%S', strtotime('next week', $now)); Expected result: ---------------- X-Powered-By: PHP/4.2.2 1059732000, Friday 01. August 2003 - 12:00:00 1059728400, Friday 01. August 2003 - 11:00:00 1059735600, Friday 01. August 2003 - 13:00:00 1059645600, Thursday 31. July 2003 - 12:00:00 1059818400, Saturday 02. August 2003 - 12:00:00 1059127200, Friday 25. July 2003 - 12:00:00 1060336800, Friday 08. August 2003 - 12:00:00 Actual result: -------------- X-Powered-By: PHP/4.3.3RC2-dev 1059732000, Friday 01. August 2003 - 12:00:00 1059728400, Friday 01. August 2003 - 11:00:00 1059739200, Friday 01. August 2003 - 14:00:00 1059645600, Thursday 31. July 2003 - 12:00:00 1059904800, Sunday 03. August 2003 - 12:00:00 1059127200, Friday 25. July 2003 - 12:00:00 1060941600, Friday 15. August 2003 - 12:00:00 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24927&edit=1

« previous php.bugs (#45275) next »