Age to birth year

Given the string “18” which is the age of a person, how can I get the
year of birth?

eggie5 schrieb:

Given the string “18” which is the age of a person, how can I get the
year of birth?
Time.now.year - ‘18’.to_i

But this is only an approximation. :wink:

Regards
Jan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs