[TriLUG] OT?: php anomaly
stan briggs
stan at StanBriggs.com
Thu Aug 17 09:04:13 EDT 2006
DJ,
and the mystery continues. note that in the code below (that adds the time
to the printed to the output) that on 10-29 it only adds 23 hours to the
day. yet, prior to and after that it adds exactly 24 hours.
now, i'm even more befuddled.
stan
-----Original Message-----
From: trilug-bounces at trilug.org [mailto:trilug-bounces at trilug.org] On Behalf
Of stan briggs
Sent: Thursday, August 17, 2006 8:51 AM
To: 'Triangle Linux Users Group discussion list'
Subject: RE: [TriLUG] OT?: php anomaly
DJ,
did you notice that this code (which is better than what i had, BTW) repeats
10-29? what the heck is up with that?
and if you change it to last year (2005) it repeats 10-30.
anyone?
stan
-----Original Message-----
From: trilug-bounces at trilug.org [mailto:trilug-bounces at trilug.org] On Behalf
Of Donald J. Sipe III
Sent: Wednesday, August 16, 2006 5:05 PM
To: Triangle Linux Users Group discussion list
Subject: Re: [TriLUG] OT?: php anomaly
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);
$LongDate = date("Y-m-d=H:i:s", $CurrentDate);
echo $LongDate . '(' . $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/
>
--
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/
--
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