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

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -