- date_create_from_format: documentation ( source)
<?php
// get the old DateTime object created from the month and year
$oldDate = date_create_from_format("n Y", "10 2013");
// get the current DateTime object
$currentDate = new DateTime();
// calculate the interval between the two
$dateInterval = $currentDate->diff($oldDate,true);
echo $dateInterval->m;