Skip to content

Instantly share code, notes, and snippets.

@ihower
Created December 17, 2008 06:39
Show Gist options
  • Save ihower/36968 to your computer and use it in GitHub Desktop.
Save ihower/36968 to your computer and use it in GitHub Desktop.
your exact age
today = Date.today
birthday = Date.new(1986, 12,31)
overflow = ( today.month > birthday.month ||
( today.month == birthday.month && today.day >= birthday.day )
)? 0 : 1
age = today.year.to_i - birthday.year.to_i - overflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment