citylayer
citylayer

Reputation: 43

strtotime summertime

I have a strange problem:
I get some data from the mysql database which I convert with strotime to a timestamp. then I compare these timestamps with a for loop:

for ($i=$start;$i<=$end;$i=$i+86400){
 $ptag=date("w",$i);
 if ($i<=$checkdateend){
   if ($wochendays[$ptag]==1){
     if (!in_array($i,$solvedays)){
      $solvedays[]=$i;
     }
   }
 }
}

with a given day (also a timestamp)
where $wochendays=(0,0,1,0,1,0,0)

this works fine, but when I cross the summer/wintertime change I get a problem.
in the solvedays array there should be these values:

27.10.2012
28.10.2012
29.10.2012

but I get

27.10.2012
28.10.2012
28.10.2012

instead.
I guess the reason is the summertime change to wintertime, but I don't have any clue how to solve this problem. any hints?

Upvotes: 3

Views: 1177

Answers (1)

amxm
amxm

Reputation: 91

Try DateTime :

$date = new DateTime('2006-12-12');
$date->modify('+1 day');
echo $date->format('Y-m-d');

Upvotes: 3

Related Questions