$date1 = new DateTime("2012-12-15 14:11:42");
$date2 = new DateTime(date('Y-m-d H:i:s'));
$month = $date1->diff(date('Y-m-d H:i:s'));
echo $month->m;
Instead of displaying the difference what i get is the warning below Warning: DateTime::diff() expects parameter 1 to be DateTime, string given in C:\xampp\htdocs\giftcodex\test.php on line 9
Notice: Trying to get property of non-object in C:\xampp\htdocs\giftcodex\test.php on line 10