0

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

1 Answers1

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