MySql calculates the time difference between two dates using the TIMESTAMPDIFF function, which can be done with a single SQL statement.
SELECT TIMESTAMPDIFF(MONTH,'2009-10-01','2009-09-01');
The first parameter can be:
SECOND seconds SECONDS
MINUTE minutes MINUTES
HOUR time HOURS
DAY days DAYS
MONTH months MONTHS
YEAR years YEARS