Hi, I always see RoR pages showing the elapsed time like that ''Published 3 days, 23 hour and 5 minutes ago'' ''Published less than 3 minutes ago'' I guess this conversion can be done using a Rails function, however I can''t find it. Does somebody know its name?? Thanks a lot Peter
Pete wrote:> Hi, > > I always see RoR pages showing the elapsed time like that > > ''Published 3 days, 23 hour and 5 minutes ago'' > ''Published less than 3 minutes ago'' > > I guess this conversion can be done using a Rails function, however I > can''t find it. > > Does somebody know its name??The functions that do this are distance_of_time_in_words and distance_of_time_in_words_to_now: http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#M000466 -- Philip Ross http://tzinfo.rubyforge.org/ -- DST-aware timezone library for Ruby
thank you so much ! :-))))))))) Philip Ross schrieb:> Pete wrote: >> Hi, >> >> I always see RoR pages showing the elapsed time like that >> >> ''Published 3 days, 23 hour and 5 minutes ago'' >> ''Published less than 3 minutes ago'' >> >> I guess this conversion can be done using a Rails function, however I >> can''t find it. >> >> Does somebody know its name?? > > The functions that do this are distance_of_time_in_words and > distance_of_time_in_words_to_now: > > http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#M000466 > >