Nice date function


#1

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


#2

Have a look at DateHelper. I think the method you want is
“time_ago_in_words”.


#3

On Jan 13, 2007, at 04:57 , Mike D. 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 S. - http://mentalized.net


#4

There is also a seperate gem call Chronic,
http://chronic.rubyforge.org, it you ever need to use this outside of
rails.

Jake


#5

There is also a seperate gem call Chronic,
http://chronic.rubyforge.org, it you ever need to use this outside of
rails.

Jake


#6

OMG! How sweet is rails… You’ve got to be kidding me!

Thank you so much!

Mike


#7

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/Helpers/DateHelper.html#M000467

-philip