Forum Moderators: coopster
At first i thought this would be simple.. maybe it is and im just tired.. But i mean, if i have a table called "birthdays" and one column would be the date and another would be a username.. How would i allow them to enter the date so that i could return an age?
//calculate years of age (input string: YYYY-MM-DD)
function birthday ($birthday){
list($year,$month,$day) = explode("-",$birthday);
$year_diff = date("Y") - $year;
$month_diff = date("m") - $month;
$day_diff = date("d") - $day;
if ($day_diff < 0 ¦¦ $month_diff < 0)
$year_diff--;
return $year_diff;
}
?>
>>>