Get Rails to save a record to the database in a non-UTC time

Posted by Shaun on Stack Overflow See other posts from Stack Overflow or by Shaun
Published on 2010-06-03T22:19:50Z Indexed on 2010/06/06 8:42 UTC
Read the original article Hit count: 311

Filed under:
|
|

Is there a way to get Rails to save records to the database without it automagically converting the timestamp into UTC before saving? The problem is that I have a few models that pull data from a legacy database that saves everything in Mountain Time and occasionally I have to have my Rails app write to that database. The problem is that every time it does, it converts the time I give it from Mountain Time to UTC, which is 6-7 hours ahead (depending on DST)! Needless to say, this really messes with reporting on that database.

If I could get around doing this, I would. Unfortunately, I can't do anything about the fact that this other database uses a different timezone, nor can I really get away from the need for this app to save to that database occasionally. If I could just get Rails to stop trying to help me, it'd be great.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about database