I have a few lines of PHP that should work, but don’t:
$date1=new DateTime();
$date2=new DateTime();
$interval=date_diff($date1,$date2);
or
$interval=$date1->diff($date2);
I even copied the example from the DateTime Docs:
$datetime1 = new DateTime('2009-10-11');
$datetime2 = new DateTime('2009-10-13');
$interval = $datetime1->diff($datetime2);
echo $interval->format('%R%a days');
The output is blank, when I debug, the debugger disconnects at the diff line without any error message. Is there any known bug in PHP Version 5.2.9 or has anyone else seen this behaviour?
I am currently out of ideas on what to try except for updating the PHP version. But updating all customers is not currently something I want to do…
Every little helps… Thanks!
DateTime:Diff()is PHP >= 5.3.0 only.Not sure why your debugger bails out completely – it should be complaining about an undeclared method. Maybe you need to adjust your error reporting settings?