This PHP function accepts a birthday as a parameter and will return the age based on that birthday. How to implement the Code!1: Open the Html basic code2: Connect the website with xampp3: Paste the code in Html code Name Code Age from DATE //Input format: YYYY-MM-DD function years_age($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; }