# Age to birth year

**URL:** <https://www.ruby-forum.com/t/age-to-birth-year/115496>\
**Category:** Ruby\
**Created:** [September 25, 2007, 7:51pm UTC](https://www.ruby-forum.com/t/age-to-birth-year/115496 "2007-09-25T19:51:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [September 25, 2007, 7:51pm UTC](https://www.ruby-forum.com/t/age-to-birth-year/115496/1 "2007-09-25T19:51:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [September 25, 2007, 8:01pm UTC](https://www.ruby-forum.com/t/age-to-birth-year/115496/2 "2007-09-25T20:01:27Z")

</div>

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. 😉

Regards  
Jan
