>From what I've experienced, you need both (rails and db) to have no time zone, >or both to be configured with time zone. Having one of each gives the problem >you see.
I have done nothing special to MySQL with time zone settings. I believe it stores datetime as GMT based on the OS time zone setting (??). In Rails 2.3 /config/environment.rb I have all time zone configs commented out. In Rails 3.x apps, I have nothing declared for time zone configuration. I think MySQL already converts the GMT to local time zone based on the client connection. So, by having Rails with time zone setting, I think it may be applying a conversion twice. Anyway, doing nothing at both ends (rails and MySQL) seems to work fine for me. -- greg willits > On Wednesday, June 20, 2012 1:04:17 PM UTC-7, Gisborne wrote: > I’m sure it’s just me, but this looks just wrong. > > My timestamp field is time without zone. > > I’ve got a suitable default time zone set in Rails. > > I create a record. > > I display the timestamp. > > The time displayed is off by 7 hours. > > The behavior that would make sense to me is that the value written to the > database would always be UTC, which would get converted to the local time > zone on display. > > But Rails appears to be doing the latter while not doing the former. So the > time in the database is local time. But when I display it, it’s having 7 > hours subtracted. > > This seems too obviously stupid. I must be missing something. -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby
