开发者

Display datetime like 1 hour ago, 5 hours ago, 3 days ago, [duplicate]

开发者 https://www.devze.com 2023-02-24 10:33 出处:网络
This question already has answers here: Closed 11 years ago. 开发者_运维问答 Possible Duplicate:
This question already has answers here: Closed 11 years ago. 开发者_运维问答

Possible Duplicate:

How do you do relative time in Rails?

I want to display the datetime like this:

30 seconds ago
1 hour ago
9 hours ago
2 days ago
1 year ago
..

Is this built in or should I write my own function to do this?


http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#method-i-distance_of_time_in_words

0

精彩评论

暂无评论...
验证码 换一张
取 消