Age From Birthday
Join the DZone community and get the full member experience.Join For Free
// description of your code here
def age_from_birthday( birthdayAsTime ) age = Date.today.year - birthdayAsTime.year if Date.today.month < birthdayAsTime.month || (Date.today.month == birthdayAsTime.month && birthdayAsTime.day >= Date.today.day) age = age - 1 end age.to_s end
Opinions expressed by DZone contributors are their own.