The date_diff function requires PHP version 5.3 or higher.
UPDATE
An example for PHP 5.2 (taken from the comments of the user date_diff).
<?php function date_diff($date1, $date2) { $current = $date1; $datetime2 = date_create($date2); $count = 0; while(date_create($current) < $datetime2){ $current = gmdate("Ymd", strtotime("+1 day", strtotime($current))); $count++; } return $count; } echo (date_diff('2010-3-9', '2011-4-10')." days <br \>"); ?>
Peter O'Callaghan
source share