- abs: documentation ( source)
- date: documentation ( source)
- strtotime: documentation ( source)
<?php
$joinDate = '2014-03-22 10:36:33';
$today = date('Y-m-d H:i:s');
$Mdate1 = strtotime($joinDate);
$Mdate2 = strtotime($today);
$months = '0';
while (strtotime('+1 MONTH', $Mdate1) < $Mdate2) {
$months++;
$Mdate1 = strtotime('+1 MONTH', $Mdate1);
}
$Mweeks = abs(strtotime($today) - strtotime($joinDate)) / 604800;
echo $months;
echo "<br>";
echo $Mweeks;
?>