Forum: Ruby on Rails nice date function

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
39025a7f572d6fe464e1fe6be399ca3b?d=identicon&s=25 Mike Dershowitz (mdersh53)
on 2007-01-13 04:57
Hi:

you know the way the google and this forum presents dates?  How it's
measure from the current date/time and presents nicely as "39 minutes
ago", 2 days ago, etc.?  Has anyone done a gem or other library object
that I can get to do those types of dates?

Thanks so much in advance!

Mike
5c8d28d1333f8e44641e74c9f72c29c7?d=identicon&s=25 Snow Man (snowman)
on 2007-01-13 05:40
Have a look at DateHelper. I think the method you want is
"time_ago_in_words".
317aad7f9f0b69a440faca74bbe22b20?d=identicon&s=25 Jakob Skjerning (Guest)
on 2007-01-19 16:29
(Received via mailing list)
On Jan 13, 2007, at 04:57 , Mike Dershowitz wrote:

> you know the way the google and this forum presents dates?  How it's
> measure from the current date/time and presents nicely as "39 minutes
> ago", 2 days ago, etc.?  Has anyone done a gem or other library object
> that I can get to do those types of dates?

Look up distance_of_time_ago_in_words in the Rails API reference.

--
Jakob Skjerning - http://mentalized.net
45959eda56edd9f2db9ebd2fabb1e582?d=identicon&s=25 jrcahoon (Guest)
on 2007-01-19 16:30
(Received via mailing list)
There is also a seperate gem call Chronic,
http://chronic.rubyforge.org, it you ever need to use this outside of
rails.

Jake
45959eda56edd9f2db9ebd2fabb1e582?d=identicon&s=25 jrcahoon (Guest)
on 2007-01-19 16:31
(Received via mailing list)
There is also a seperate gem call Chronic,
http://chronic.rubyforge.org, it you ever need to use this outside of
rails.

Jake
2f9a03aa0fcfe945229cb6126eda2cb2?d=identicon&s=25 Philip Hallstrom (Guest)
on 2007-01-19 16:31
(Received via mailing list)
> you know the way the google and this forum presents dates?  How it's
> measure from the current date/time and presents nicely as "39 minutes
> ago", 2 days ago, etc.?  Has anyone done a gem or other library object
> that I can get to do those types of dates?

It's builtin to Rails...

time_ago_in_words()

http://api.rubyonrails.com/classes/ActionView/Help...

-philip
39025a7f572d6fe464e1fe6be399ca3b?d=identicon&s=25 Mike Dershowitz (mdersh53)
on 2007-09-25 22:31
(Received via mailing list)
OMG!  How sweet is rails.. You've got to be kidding me!

Thank you so much!

Mike
This topic is locked and can not be replied to.