Is there any function equivalent to DateTime::diff() in PHP 5.2?
My local server is PHP 5.3 and using DateTime::diff(). then I found that my live site uses PHP 5.2 a
PHP has methods for working with Unix timestamps.
As has been noted by others, by working with seconds since the Unix date, it is easy to calculate times.
PHP's strtotime() converts a date to a timestamp:
$diff = round((strtotime($list['start']) - strtotime($list['finish'])) / 86400);
If you wish to calculate till the current time, time() provides the timestamp of "now":
$diff = round((time() - strtotime($list['date'])) / 86400);
86400 is the number of seconds in a day.
If you wish to convert to years use 31557000, which is almost exactly 365.24219 * 86400.
An added advantage here is that strtotime can take the input date in almost any human readable format, so it is very easy to work with within the code.