Thanks kaikki for your help.
I tried to use your code like this, just for testing:
<?
$fill_month = 11;
$fill_day = 22;
$fill_year = 2007;
$birth_month = 12;
$birth_day = 22;
$birth_year = 1947;
$filldatestamp = mktime(0, 0, 0, $fill_month, $fill_day, 1970);
$birthstamp = mktime(0, 0, 0, $birth_month, $birth_day, 1970);
$minusOne=false;
if ( $birthstamp < $filldatestamp )
{
$birthstamp = mktime(0, 0, 0, $birth_month, $birth_day, 1971);
$minusOne = true;
}
$age = $fill_year - $birth_year;
if ( $minusOne )
{
$age--;
}
$age+= date_format( '%m', $filldatestamp - $birthstamp )/12;
echo $age;
?>
However, I got this error:
Warning: date_format() expects parameter 1 to be DateTime, string given in /home/muamshai/public_html/ing/as.php on line 24
I am exactly unable to understand this error 🙂