I have this code in my script
PHP Code:
$date1 = new DateTime($Date['ori']['start']);
$date2 = new DateTime($Date['ori']['end']);
$interval = $date1->diff($date2);
$daysDifference = $interval->d;
Which works on my localhost (PHP 5.3.1). However my web server only has PHP 5.2.17. Is there any other function i could use? All i need to do is get how many days difference there is between 2 dates.
EDIT: Turns out its just the diff function that does work. Fixed it by using
PHP Code:
$date1 = new DateTime($Date['ori']['start']);
$date2 = new DateTime($Date['ori']['end']);
$daysDifference = round(abs($date2->format('U') - $date1->format('U')) / (60*60*24));