I’m using Rail 2.3.2 and I want to include time zones with my
application by putting:
config.time_zone = “Pacific Time (US & Canada)”
in my environment.rb.
This works fine on my Mac development machine but I move to production
it gets messed up…For instance I have a condition as follows:
:conditions => [’(effective_end_date IS NULL OR effective_end_date > ?)
AND (effective_start_date IS NULL OR
effective_start_date < ?) ',Time.now.gmtime, Time.now.gmtime]
Which works fine on development as mentioned earlier by looking at
queries but on production I got something like this
SELECT * FROM
sms_messages WHERE (
sms_messages.user_id = 1 AND
(created_at > ‘2009-04-05 05:18:23’ and status != ‘SCHEDULED_MESSAGE’))
AND (((effective_end_date IS NULL OR effect
ive_end_date > ‘2009-05-03 03:19:57’)
AND (effective_start_date IS NULL OR effective_start_date < ‘2009-05-03
03:19:57’) ) AND (
sms_messages.user_id = 1)) ORDER BY created_at DESC
But when I try to fetch time form IRB:
=> Mon May 04 22:24:27 -0700 2009
=> Tue May 05 05:24:34 UTC 2009
Which seems correct!!! It’s like as if instead of adding 7 hours to get
the UTC time it negates 7 hours from the current time!
Not sure if I have to do extra setting for production machine.
Any ideas how to go about finding what the problem is?