You also can use the DateHelper (http://api.rubyonrails.org/classes/ ActionView/Helpers/DateHelper.html). Always the Rails API is the best place to start.
Regards. Franco Catena. On Jul 16, 1:22 am, Valentino Lun <[email protected]> wrote: > Dear all > > Is there any existing function in rails to calculate time? I have google > it but no information found.. > > For example > a = "2009-07-16 12:34".to_time > b = "2009-07-16 12:04".to_time > some_method(a,b) return "30 mins ago" > > c = "2009-07-16 12:34".to_time > d = "2009-07-12 09:09".to_time > some_method(c,d) return "4 days ago" > > If not, I will write it by my own. But it can save my time if there is > existing method to do so... > > Many thanks > Valentino > -- > Posted viahttp://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

