ID: 16429 Comment by: swek at gmx dot net Reported By: sveinp at basefarm dot no Status: No Feedback Bug Type: Date/time related Operating System: Solaris/Linux PHP Version: 4.3.0-dev New Comment:
PHP version 4.3.1 reused the code found here recently. <?php $today = mktime(9, 28, 0, 4, 1, 2003); print date("r", $today) . "<BR>"; print date("r", strtotime("last saturday", $today)) . "<BR>"; print date("r", strtotime("last sunday", $today)) . "<BR>"; print date("r", strtotime("last monday", $today)) . "<BR>"; ?> Tue, 1 Apr 2003 09:28:00 +0200 Fri, 28 Mar 2003 23:00:00 +0100 Sat, 29 Mar 2003 23:00:00 +0100 Mon, 31 Mar 2003 00:00:00 +0200 how to handle this? everything before monday seems to get 1 day less. Previous Comments: ------------------------------------------------------------------------ [2003-01-17 22:09:38] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ [2003-01-02 19:52:15] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-latest.zip ------------------------------------------------------------------------ [2002-08-22 12:42:40] ilia at prohost dot org After a few more tests I was able to replicate the problem, it appears that if I set the date higher then the date on which the change occurs, the functions messes up. For example: <?php $today = mktime(9, 28, 0, 4, 8, 2002); print date("r", $today) . "\n"; print date("r", strtotime("last saturday", $today)) . "\n"; ?> ------------ Mon, 8 Apr 2002 09:28:00 -0400 Fri, 5 Apr 2002 23:00:00 -0500 ------------------------------------------------------------------------ [2002-08-22 12:39:00] ilia at prohost dot org <?php $today = mktime(9, 28, 0, 4, 7, 2002); print date("r", $today) . "\n"; print date("r", strtotime("last saturday", $today)) . "\n"; ?> ------------ Sun, 7 Apr 2002 09:28:00 -0400 Sat, 6 Apr 2002 00:00:00 -0500 Seems to work fine, even across DST. ------------------------------------------------------------------------ [2002-08-19 19:07:22] msopacua at idg dot nl Rasmus, Ilia. Please look at your results: The timezone is the same, as there was no DST jump in that weekend for you. http://www.timeanddate.com/time/dstevents.html Please try for one week later. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/16429 -- Edit this bug report at http://bugs.php.net/?id=16429&edit=1