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 probably have guessed, that's to calculate person's age automatically. The closest one is distance_of_time_in_words
Rails helper, so the following template
Jack is <%= distance_of_time_in_words (Time.now, Time.local(1950,03,22)) %> old.
yields
Jack is over 59 years old.
But I need more precise function that yields just number. Is there one?
If there exists some kind of Ruby on Rails helper function for this, this is OK, although pure Ruby solution would be better.
Edit: the gist of the question is that a non-approximate solution is needed. At the 2nd of March Jack should be 59 years old and the next day he should be 60 years old. Leap years and such should be taken into account.