Time

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!

Hi -

If I am understanding correctly you can use the Time#strftime
directives.

http://www.ruby-doc.org/core/classes/Time.html

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs