I have php code where it calculate the current age from birth date.
My problem how do I determine the age if I simply predict what will the age of the person at a given Date.
For example what will be the age of the person by the year 2020 May 30 and not the current Year we have which is 2014, added will be how many months it has been since that person's birthday.
I didn't find any related post here since most of it calculate the age at the current date.
Here's the code for calculating age at the current DATE.
<?php
// if-> To Check whether form has been submitted
if(isset($_POST['submit']))
{
$d=$_POST['day'];
$m=$_POST['month'];
$y=$_POST['year'];
//converting Inputed DOB in "dd-mm-yyyy" format
$dob=$d.'-'.$m.'-'.$y;
//Create a new date object with current system date
$bday=new DateTime($dob);
//Differentiating both dates
$age=$bday->diff(new DateTime);
$today=date('d-m-Y'); //Current date
echo '<br /><br /><br />';
echo '<b>Your Birth date: </b>';
echo $dob;
echo '<br><b>Today : </b> ';
echo $today;
echo '<br>';
echo '<b>Your Age : </b> ';
echo $age->y;
echo ' Years, ';
echo $age->m;
echo ' Months, ';
echo $age->d;
echo ' Days';
}
?>
I simply want to determine the age of that person in advance with Years and Months.
Tnx in advance.