Strange to_formatted_s problem

my time zone is set like this

config.time_zone = ‘Tokyo’

I got this from console

temp1.updated_at
=> Tue, 06 Oct 2009 13:26:57 JST +09:00

temp1.updated_at.to_formatted_s(:db)
=> “2009-10-06 04:26:57”

temp1.updated_at.to_formatted_s(:long)
=> “October 06, 2009 13:26”

Can anyone tell me why I get different results when using :db
and :long in to_formatted_s?

On Oct 6, 6:05 am, boblu [email protected] wrote:

=> “2009-10-06 04:26:57”>> temp1.updated_at.to_formatted_s(:long)

=> “October 06, 2009 13:26”

Can anyone tell me why I get different results when using :db
and :long in to_formatted_s?

Why would you expect them to be the same ?

Fred

On Oct 6, 8:57 am, Frederick C. [email protected]
wrote:

Oops, hadn’t noticed that the time of day was different by 9 hours.
This is almost certainly because ActiveRecord wants to keep things in
the database in UTC.

Fred

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