Code added to this post will calculate date difference in days, months, years format. So using this code you can calculate age by sending birth date as parameter. Or you can calculate difference between today’s date and any date in past.