How to calculate how many years passed since a given date in Ruby?

前端 未结 13 2261
被撕碎了的回忆
被撕碎了的回忆 2020-12-09 16:33

This question was here for other languages, so let here be one for Ruby.

How do I calculate number of complete years that have passed from a given date? As you prob

13条回答
  •  北荒
    北荒 (楼主)
    2020-12-09 16:56

    withing http://github.com/radar/dotiw

    Jack is <%= distance_of_time_in_words (Time.now, Time.local(1950,03,22)) %> old.
    

    produce

    Jack is 60 years old
    

提交回复
热议问题