views:

60

answers:

1

Why between those dates i get 5,9.... and if i use another year i get 6 ???? It only happens with march and 2008... why is there an hour difference ???

<?php
 $from = '2008-03-04';
 $to = '2008-03-10';

 echo datediff($from,$to);

 $from = '2010-03-04';
 $to = '2010-03-10';

 echo datediff($from,$to);

 function datediff($from,$to)
 {
  $diff = strtotime($to) - strtotime($from);
  $diff = $diff/(60*60*24);
  return $diff;
 }
?>
+3  A: 

Daylight Saving Time.

Ignacio Vazquez-Abrams
Yes, Is PHPbut i don't know if is a PHP error or a TIMESTAMP one
Gmi182
Neither. It's just a fact that there were only 143 hours between midnight of March 4, 2008 and midnight of March 10, 2008, instead of 144.
Ignacio Vazquez-Abrams
why? a day has 24hs. Why there?
Gmi182
Nope. Days that are undergoing a DST change have either 23 or 25 hours.
Ignacio Vazquez-Abrams