How to find the present age in years and month from php program. I can find out todays date and time. But I need to find out age of any unknown person by using php formula. Thanks
Asked
Active
Viewed 44 times
0
-
Create a date picker to enter birthday date and then calculate time passed from that day to today. – Federica Venuto Dec 06 '15 at 06:56
1 Answers
0
Like this for example: (I do not have tested the code but it should work)
<?php
//full age calulator
$bday = new DateTime('02.08.1991');//dd.mm.yyyy
$today = new DateTime('00:00:00'); // Current date
$diff = $today->diff($bday);
printf('%d years, %d month, %d days', $diff->y, $diff->m, $diff->d);
?>

Federica Venuto
- 582
- 4
- 15