How can I calculate an age in years and months, given a birth date of format YYYY-MM-DD? Is it possible using the Date() function?
I have done in php. Below is my code
$dateOfBirth = date("Y-m-d", strtotime($post->date_of_birth));
$today = date("Y-m-d");
$age= $diff->format("%Y Years, %M Months");
echo $age;
I am getting the results in json.Can i embed the php code in json while diplaying or how can i get the age in years and months using date of birth....??