Rails timezone and Daylight saving time

ruby-on-rails, ruby-on-rails-3

Solution

7 months after you asked, but perhaps `skip_time_zone_conversion_for_attributes=` will help - it tells AcitveRecord not to convert timezones on storage or retrieval. See ActiveRecord Timestamp which shows the example:

class Topic < ActiveRecord::Base
  self.skip_time_zone_conversion_for_attributes = [:written_on]
end

Problem

for a while I´m trying to understand how this timezone times will work, and I had a question: Today in my country, we are in Daylight saving time (GMT-2). So the user of my application enter a time, like 11:00AM and post the form. Far as I know, rails will convert this date to UTC and save in the database (mysql in my case), like: 01:00PM UTC. When I recover that record, I had to convert to local time to display. Ok? My question is, lets suppose that this date/time represents a date/time in future, when my country gets out from summer time (GMT-3). Rails will save 01:00PM UTC? Today, in Daylight saving time, how will be the local time? And in the future, how will be this local time? Basically, I always need to display to user 11:00AM. thanks.

Original source