get the difference in months between two dates
using a unix time stamp?

I know I can do something like this:

$startMonth = date( "m", $startTimestamp );
$startYear = date( "Y", $startTimestamp );
$endMonth = date( "m", $endTimestamp );
$endYear = date( "Y", $endTimestamp );

$numMonths = $endMonth - $startMonth;
if( $startMonth > $endMonth ) {
  $numMonths += 12;

}
$numMonths += ( 12 + ( $endMonth - $startMonth ));

Is there some better way?

Chris

Reply via email to