[FX.php List] Even stranger date math...
Troy Meyers
tcmeyers at troymeyers.com
Sun Sep 30 14:28:47 MDT 2007
Yeah, I think it's the end of DST. Offsetting your calc to noon seems to take care of it:
<?php
$d1 = "10/28/2007";
echo "$d1<br/>";
$d2 = date("m/d/Y", strtotime ($d1, 0) + 86400 + 43200);
echo "$d2<br/>";
$d3 = date("m/d/Y", strtotime ($d1, 0) + (2*86400) + 43200);
echo "$d3<br/>";
$d4 = date("m/d/Y", strtotime ($d1, 0) + (3*86400) + 43200);
echo "$d4<br/>";
$d5 = date("m/d/Y", strtotime ($d1, 0) + (4*86400) + 43200);
echo "$d5<br/>";
$d6 = date("m/d/Y", strtotime ($d1, 0) + (5*86400) + 43200);
echo "$d6<br/>";
$d7 = date("m/d/Y", strtotime ($d1, 0) + (6*86400) + 43200);
echo "$d7<br/>";
$d8 = date("m/d/Y", strtotime ($d1, 0) + (7*86400) + 43200);
echo "$d8<br/>";
$d9 = date("m/d/Y", strtotime ($d1, 0) + (8*86400) + 43200);
echo "$d9<br/>";
$d10 = date("m/d/Y", strtotime ($d1, 0) + (9*86400) + 43200);
echo "$d10<br/>";
$d11 = date("m/d/Y", strtotime ($d1, 0) + (10*86400) + 43200);
echo "$d11<br/>";
$d12 = date("m/d/Y", strtotime ($d1, 0) + (11*86400) + 43200);
echo "$d12<br/>";
$d13 = date("m/d/Y", strtotime ($d1, 0) + (12*86400) + 43200);
echo "$d13<br/>";
echo "$d8---$d9";
?>
-Troy
> OK, so I decided to use a WHILE loop, and the results are just as
> strange:
>
> <?php
>
> $d1 = "10/28/2007";
>
> $thetime = strtotime($d1);
>
> $x = 2;
>
> while ($x < 43){
>
> $thetime = $thetime + 86400;
>
> $d[$x] = date('m/d/Y',$thetime);
>
> echo $d[$x]."<br>";
>
> $x++;
>
> }
>
> ?>
>
> Check it out... why does this not work right?
>
> _______________________________________________
>
> FX.php_List mailing list
>
> FX.php_List at mail.iviking.org
>
> http://www.iviking.org/mailman/listinfo/fx.php_list
More information about the FX.php_List
mailing list