you are in: codestackercodes [RSS]age calculation

age calculation Delicious Email

show/hide lines
   1  # one method
   2  def age
   3   ((Time.now - birthday)/(60*60*24)/365.2422).to_i
   4  end
   5  
   6  # second method
   7  def birthday
   8      @birthday = Time.local( birth_year, birth_month, birth_day )
   9    end
  10    
  11    def age
  12      ((Time.now - birthday) / 1.year).to_i
  13    end 
created by leozera — 19 September 2008 — get a short url — tags: age ruby time embed

Comments



We dont send spam :)

If checked, it's highlights your comment
simple_captcha.jpg
Are you a human? Type the code from the image