Activerecord automatically stores the time for created_at and updated_at as UTC, and this is what it looks like: 2008-07-21 18:55:29 UTC How can I get the Time.now to look like that? I''m trying to find the difference of the Time.now and created_at so I can get a number of days, hours, or seconds depending on the magnitude of the difference, since my object was created. Thanks! -- Posted via http://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi - If I am understanding correctly you can use the Time#strftime directives. http://www.ruby-doc.org/core/classes/Time.html Justin To wrote:> Activerecord automatically stores the time for created_at and updated_at > as UTC, and this is what it looks like: 2008-07-21 18:55:29 UTC > > How can I get the Time.now to look like that? > > I''m trying to find the difference of the Time.now and created_at so I > can get a number of days, hours, or seconds depending on the magnitude > of the difference, since my object was created. > > Thanks!--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---