标签: ruby-on-rails ruby
可能重复: How do you do relative time in Rails?
我想像这样显示日期时间:
30 seconds ago 1 hour ago 9 hours ago 2 days ago 1 year ago ..
这是内置的还是我应该编写自己的函数来执行此操作?
答案 0 :(得分:7)
http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#method-i-distance_of_time_in_words