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
Same idea as FM but with a simplified if statement. Obviously, you could add a second argument instead of using current time.
def age(birthdate) now = DateTime.now age = now.year - birthdate.year age -= 1 if(now.yday < birthdate.yday) age end