Error when manipulating the date 2008-11-02

I'm coming across a very strange problem when  my script hits 2008-11-02 and I'm not sure why. What the script does is accept a start date and an end date and then loops through days between. It works perfectly as long as the date range doesn't include 2008-11-02. If it does, it will never get passed that date during the accumulation looping process. What am I missing? Any help would be most appreciated.
<?php
		$s = date("Y-m-d", strtotime($_POST['startDate']));
		$e = date("Y-m-d", strtotime($_POST['endDate']) + 86400);
		while($s != $e){
			$count++
    ?>
    	<th align="right"><?= date("Y-m-d", strtotime($s)); ?></th>
    <?php
			$time = strtotime($s) + 86400;
			
			$s = date("Y-m-d", $time);
			if($count > 200){
				die("This catch is in here for the 11/02/2008 bug.");
			}
		}
     ?>

Open in new window

brettfarrisAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

spoxoxCommented:
Because Nov 2 the time changed.

You need to add another 3600 seconds to make up the shortfall for that day (only).
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
spoxoxCommented:
i.e.

      $time = strtotime($s) + 86400;
      if ($time == 1225684800) $time+= 3600; // might be a nicer way to do this!
0
brettfarrisAuthor Commented:
Excellent, that definitely sent me in the right direction. Thanks for your assistance. Here's how I handled it:
$time = strtotime($s) + 86400;
			
// The following block handles time change.
if((string)date("Y-m-d", $time) == (string)date("Y-m-d", strtotime($s))){
  $time += 3600;
}

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.