using php to find the rounded down number of months between two dates

I want to find the number of days between two dates, then find the fractional number of months between the two dates, then rounddown the number of frational months to a whole number. I know there are a number of ways to do this and was hoping you could give me some tips on the best way. I have reviewed some of the examples on php.net and there are many ways that this can be done.
here is a brief e.g.
$start_date = 11/1/07
$final_date = 11/17/08
$final_date - $start_date = $number of days
$months = $number_of_days/365.25 *12
$months_rounded_down = rounddown($months)

from php.net
function round_down($num, $d = 0)
{
    return sgn($num)*p_floor(abs($num), $d);
}

thanks for the help
derekstattinAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sistemuCommented:
Hi,

The number of days between two dates was already solved in this question:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_23780439.html

I am not aware of other, simpler methods, to calculate the number of months.
0
Ray PaseurCommented:
You should probably carry your dates in ISO8601 format like YYYY-MM-DD.  This is the MySQL DATE format, and is created in PHP with date('Y-m-d').  This format has the advantages of being sortable and unambiguous.  You can make dates pretty for human-readable display, but internally you are better off using the ISO standard.

Days between 2 dates:
http://us.php.net/manual/en/function.mktime.php#86916

Tell us a little bit more about what you want to do with months.  For example, do you want to count the calendar months, not considering the differences in the number of days?  If so, you might use year difference * 12 + (old_month - new_month - 1).  If you want to count 30-day periods, you need a little more math.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.