How convert a string into a ActiveSupport::TimeWithZone?

Posted by Nisanio on Stack Overflow See other posts from Stack Overflow or by Nisanio
Published on 2010-04-09T15:30:44Z Indexed on 2010/04/09 15:33 UTC
Read the original article Hit count: 407

Filed under:
|
|

How convert a string into a ActiveSupport::TimeWithZone? My dilemma is this. I need to update a field (called updated_at). The field in mysql is datetime, and the class is ActiveSupport::TimeWithZone. But the dates are strings like "10/17/2008". I used "10/17/2008".to_date (And I intend .to_time and to_datetime), and even if in console the ActiveRecord class save succesfully, the field in the database still is the current date...

Thanks in advanced.

© Stack Overflow or respective owner

Related posts about rails

Related posts about activerecord