ruby on rails - Force time to be stored without localization? -
we building rails application needs read data database created, , used, application have no control over.
the other application stores of time information in utc time field forces local time stored there.
example:
current time: 2014-04-15 11:36:54 -0600 current time in utc: 2014-04-15 17:36:54 utc time stored in db: 2014-04-15 11:36:54 utc my problem rails wants convert local time utc when stores time.
is there way can tell rails not change times utc when stores them?
update:
so guess real question how can store local time in database still have utc in models?
if set
activerecord::base.default_timezone = :local then should use local timezone (as set tz environment variable etc.). it's manage local timezone , take care of oddities due timezone changing (eg if observe daylight savings time)
Comments
Post a Comment