This question was here for other languages, so let here be one for Ruby.
How do I calculate number of complete years that have passed from a given date? As you prob
you can use the ruby gem adroit-age
It works for leap years also..
age = AdroitAge.find_age("23/01/1990")
Update
require 'adroit-age' dob = Date.new(1990,1,23) or dob = "23/01/1990".to_date age = dob.find_age #=> 23