Skip to content

Instantly share code, notes, and snippets.

@boy3vil
Last active December 21, 2015 04:19
Show Gist options
  • Save boy3vil/6249093 to your computer and use it in GitHub Desktop.
Save boy3vil/6249093 to your computer and use it in GitHub Desktop.
<?php
$date1=date('2011-1-1');
$date2=date('2011-5-2');
echo "date1 :: ".$date1."<br>";
echo "date2 :: ".$date2."<br>";
$date_diff=strtotime($date2)-strtotime($date1);
echo "date difference in months => ".floor(($date_diff)/2628000)." months <br>";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment