Displaying 2 results from an estimated 2 matches for "month_diff".
2005 Dec 18
13
calculate age based on DoB
Hi,
I wrote a little helper that calulates someone''s age based on his/her
date of birth.
def age(dob)
diff = Date.today - dob
age = (diff / 365.25).floor
age.to_s
end
It works fine, but it''s not completely accurate as it just takes the
average days in a year. It should be able to calculate this more
accurately, right? I can''t work it out
2006 Jan 22
23
calculate users age
i know it''s probably really simple, how do i work out someone''s age if i
have their d.o.b. stored as a date in my db.
cheers
--
Posted via http://www.ruby-forum.com/.