There is no function persay, thou I find that converting the two dates into unix timestamps then subtracting one day from the other thereby getting the number of seconds between the two dates, then since Timestamp value 0 = UNIX Epoch time [thats 0 days 0 months 0 years] you just use the standard gmdate (UNIX time is based from GMT) function to extract the required information... Probably made it sound more confuzzling than I needed to so I'll follow this with a php function I wrote a year or so ago.
function GetDays($date1,$date2)
{
$timestamp1 = strtotime($date1);
$timestamp2 = strtotime($date2);
$dif = $timestamp1 - $timestamp2;
$days = gmdate('z',$dif);
return $days;
}
Of course this is a rather scaled down version of that code so that it is more readable you can probably see how easy this is to expand apon.
Want to get the total number of days/weeks/months/years between two dates then just change the string 'z' to another letter or set of letters.
i.e. - Show the number of days/months/years til a certain date would be somthing like this:
$string = gmdate('Days til Christmas: j Days, n Months, Y Years',$dif);
Of course if you wanted each part placed nicely into variables or arrays you could either parse it or handle each line separatly.
$days = gmdate('j',$dif);
$months = gmdate('n',$dif);
$years = gmdate('Y',$dif);
Hope this helps 🙂