PHP's DateTime::Diff gets it wrong?
DateTime::Diff should calculate a proper interval and take into account Daylight Savings Time (DST) and leap years. Although apparently it isn't so. Code of horror: $d1 = new DateTime("2011-10-30 01:05:00", new DateTimeZone("Europe/Stockholm")); $d2 = new DateTime("2011-10-30 03:05:00", new DateTimeZone("Europe/Stockholm")); echo $d1->getOffset() / (60 * 60); Prints '2'! Keep in mind thus that UTC time = 1h - 2h = 23:05:00 the day before. echo $d2->getOffset() / (60 * 60); Prints '1'. DST happened. UTC time = 3h - 1h = 02:05:00. $di = $d1->diff($d2); echo "Hours of DateInterval: " . $di->h;