I\'d like to get a person\'s age from its birthday. now - birthday / 365 doesn\'t work, because some years have 366 days. I came up with the following code:
now - birthday / 365
My suggestion:
def age(birthday) ((Time.now - birthday.to_time)/(60*60*24*365)).floor end
The trick is that the minus operation with Time returns seconds