开发者

How do i create a human readable datediff in Rails

开发者 https://www.devze.com 2023-01-12 10:34 出处:网络
I have a timestamp that represents the last time a particular record was viewed. I want to present to the user a display that gives a human readable representation of the difference between that time

I have a timestamp that represents the last time a particular record was viewed. I want to present to the user a display that gives a human readable representation of the difference between that time and now.

So it should be something like

"Last viewed 38 seconds ago"

or "Last viewed 1 hour 15 minutes 10 seconds ago"

Is there a quick way to do t开发者_运维知识库his in rails?


distance_of_time_in_words, or dotiw (allegedly better)

0

精彩评论

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