how to calculate the date of birth by giving the date, month, year in the registration page

Is that a thought, or a request?

If it's a request, you'll have to explain your desire quickly and show some effort. Something along the lines of "I want to do X, but I'm not sure how. Can someone suggest a way to me?" or "I want to do X, tried Y, but got Z. How can I do X?"

I believe you want to calculate the age if teh date of birth is given:

If that is the case you can use the following function:

function persons_age($year, $month, $day)

//list($year, $month, $day) = split('[-.]', $BirthDate);

   $tmonth = date('n');
   $tday = date('j');
   $tyear = date('Y');
   $years = $tyear - $year;
   if ($tmonth <= $month)
       if ($month == $tmonth)
           if ($day > $tday)
   return $years;

Edited 3 Years Ago by happygeek: fixed formatting

Is there a way to determine the year of birth based on the age given? Also, is there a way to tell the function that the year you want to base the age on is 1992? As if the current year was 1992. Does that make sense?

$dob="1980-07-31"; $today=date("Y-m-d");
echo $year ." year, ". $month ." months and  ". $day. " Days";

Edited 6 Years Ago by Ezzaral: Added code tags. Please use them to format any code that you post.

This article has been dead for over six months. Start a new discussion instead.