I need it for an unit test... how to get a time.now in the same format as active record returns for a datetime field?
no, the time form activerecord has UTC too
tapioco123
2010-08-09 23:27:50
A:
The UTC is probably added by Rails itself. Have you checked at your database console how exactly is stored the date?
Anyway, a shorter way to do the above is Time.now.to_s(:db)
, but what you're probably looking for is Time.now.to_formatted_s :rfc822
(Documentation here)
Chubas
2010-08-10 07:20:24