Well… I have been ignoring this for a few weeks, because it is not a huge deal, but I thought I might as well fix this.

Problem: The created_at and updated_at dates do not match my system time.  Every time I save a record, ActiveRecord records the date 5 hours ahead of my local time.  This was messing up some of my cronjobs that run 5 minutes before midnight.  Some of the records were not being found, because the date was recorded five hours in the future.

Solution:  After some digging on Google, I figured out that this is set in config/environment.rb.

# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run “rake -D time” for a list of tasks for finding time zone names.
config.time_zone = ‘UTC’

I did some more digging and found that UTC is 5 hours ahead of ET, so ActiveRecord was using this timezone instead of my local timezone.  The first fix I tried did not work, which was to chagne config.time_zone =”Eastern Time (US & Canada)’  I restarted my app server and still saw created_at was five hours ahead of my server’s system time.  So then I just commented it out and restarted the app again.  Walah.. it works now.  So the correct config to use system timezone is as follows:

# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run “rake -D time” for a list of tasks for finding time zone names.
#config.time_zone = ‘Eastern Time (US & Canada)’

No more worries