|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-08-03 17:58 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 22 23:00:01 2025 UTC |
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