Calculate Age out of Date Of Birth

Generally we store date of birth in our database and in front end we have to display age also. In php we can use following code to calculate AGE out of date of birth.

$dateofbirth = “12/08/1984”;
echo floor((time() – strtotime($dateofbirth))/31556926);

Any question please write in comments.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.