Rails: How do I get created_at to show the time in my current time zone?

Posted by Schneems on Stack Overflow See other posts from Stack Overflow or by Schneems
Published on 2009-12-31T04:28:44Z Indexed on 2012/11/01 23:01 UTC
Read the original article Hit count: 185

Filed under:
|
|

Seems that when i create an object, the time is not correct. You can see by the script/console output below. Has anyone encountered anything like this, or have any debugging tips?

 >> Ticket.create(...)
=> #<Ticket id: 7, from_email: "[email protected]", ticket_collaterals: nil, to_email: "[email protected]", body: "hello", subject: "testing", status: nil, whymail_id: nil, created_at: "2009-12-31 04:23:20", updated_at: "2009-12-31 04:23:20", forms_id: nil, body_hash: nil>
>> Ticket.last.created_at.to_s(:long)
=> "December 31, 2009 04:23"
>> Time.now.to_s(:long)
=> "December 30, 2009 22:24"

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about datetime