ID: 43472
Updated by: [EMAIL PROTECTED]
Reported By: phil at goli dot at
-Status: Open
+Status: Wont fix
Bug Type: Date/time related
Operating System: FreeBSD 6.2-RELEASE-p1
PHP Version: 4.4.7
New Comment:
We are sorry, but we can not support PHP 4 related problems anymore.
Momentum is gathering for PHP 6, and we think supporting PHP 4 will
lead to a waste of resources which we want to put into getting PHP 6
ready.
Previous Comments:
------------------------------------------------------------------------
[2008-06-23 14:31:08] danmagicman7 at gmail dot com
For clarification, strtotime will not advance to "Next Sunday" if it is
given a date that lands on a Sunday.
Here is a workaround if you are writing something that needs to advance
to the next Sunday, but you may not be giving it a date that starts with
a sunday every time (in my case something that splits up weeks of a
month):
$i was a result of a for loop, in my case.
if(date('D',$your_date) == 'Sun'){
$sunday_offset = 1;
} else {
$sunday_offset = 0;
}
$next_sunday = strtotime("next Sunday +" . ($i+$sunday_offset) .
"week", $your_date);
------------------------------------------------------------------------
[2008-06-23 14:25:44] danmagicman7 at gmail dot com
The problem is with "next Sunday". It will not advance to the next
Sunday. I ran into this problem as well.
------------------------------------------------------------------------
[2007-12-01 17:07:25] phil at goli dot at
Description:
------------
the problem described occurs only in the version 4.4.7
the script below produces the following output when run as a
web-script:
$myFirstAdvent: 12-02
$mySecondAdvent: 12-09
$myThirdAdvent: 12-16
$myFourthAdvent: 12-23
the script below produces the following output when run via command
line:
$myFirstAdvent: 12-02
$mySecondAdvent: 12-02
$myThirdAdvent: 12-02
$myFourthAdvent: 12-02
Reproduce code:
---------------
<?php
$myTmp = strtotime("first Sunday", mktime(0, 0, 0, 11, 27, 2007) );
// date("Y", myDST())
$myFirstAdvent = date("m-d", $myTmp);
$myTmp = strtotime("next Sunday", $myTmp);
$mySecondAdvent = date("m-d", $myTmp);
$myTmp = strtotime("next Sunday", $myTmp);
$myThirdAdvent = date("m-d", $myTmp);
$myTmp = strtotime("next Sunday", $myTmp);
$myFourthAdvent = date("m-d", $myTmp);
echo '$myFirstAdvent: ' . $myFirstAdvent . "\n";
echo '$mySecondAdvent: ' . $mySecondAdvent . "\n";
echo '$myThirdAdvent: ' . $myThirdAdvent . "\n";
echo '$myFourthAdvent: ' . $myFourthAdvent . "\n";
?>
Expected result:
----------------
if run in the command line it should also the correct dates:
$myFirstAdvent: 12-02
$mySecondAdvent: 12-09
$myThirdAdvent: 12-16
$myFourthAdvent: 12-23
Actual result:
--------------
if run in the command line it displays these dates:
$myFirstAdvent: 12-02
$mySecondAdvent: 12-02
$myThirdAdvent: 12-02
$myFourthAdvent: 12-02
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43472&edit=1