[TriLUG] OT?: php anomaly

Donald J. Sipe III donald.sipe at gmail.com
Wed Aug 16 17:04:37 EDT 2006


I think having string values in the where{} loop is what is doing you in.
Try this:


<?
$CurrentDate = strtotime("2006-10-24");
$EndDate     = strtotime("2006-11-15");
while ( $CurrentDate <= $EndDate ) {
       $ShortDate  = date("m-d"  , $CurrentDate);
       $MySQL4date = date("Y-m-d", $CurrentDate);
       echo $ShortDate . '(' . $CurrentDate . ')[' . $MySQL4date . "]\n";
       $CurrentDate += 86400 ;
}
?>


Cheers,
DJ


On 8/16/06, stan briggs <stan at stanbriggs.com> wrote:
>
> all,
>
> can anyone help me understand why it is that on or about 10-29 of each
> year
> i can't get php to increment the unix date? here is the php code that i'm
> using:
> <?
> $CurrentDate = "2006-10-24";
> $EndDate = "2006-11-15";
> while ( $CurrentDate <= $EndDate ) {
>         $CurrentUnixDate = strtotime($CurrentDate);
>         $ShortDate = date("m-d",$CurrentUnixDate);
>         echo "$ShortDate($CurrentUnixDate)[$CurrentDate]\n";
>         $CurrentUnixDate = $CurrentUnixDate + 86400 ;
>         $CurrentDate = date("Y-m-d",$CurrentUnixDate);
> }
> ?>
>
> this code stops incrementing on 10/29. note that if you change the year to
> last year or to next year you get the same behavior on a slightly
> different
> date.
>
> someone impress me,
> stan
>
> Stan B. Briggs
> +1-919-461-1096
>
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>



More information about the TriLUG mailing list