Q:
I've got a datetime column in my database for a person's age. How wouldA:
I be able to calculate the number of years they are from the DB date to
current time?
ruby 代码
- def age
- ((Time.now - birthday)/(60*60*24)/365.2422).to_i
- end