rails timezone difference in console and production application

Hi all,

I'm on a rails 2.3.5 app. I've got my timezone set to 'Brussels';

config.time_zone = 'Brussels'

When I use mysql I see that a date is stored in UTC (as expected); e.g. 2010-04-07 15:03:10

When I use console to print out the date it correctly returns;

job.created_at.strftime('%d %b %Y, %H:%M')

=> "07 Apr 2010, 17:03"

The Time.zone in console returns "Brussels" with an offset of 3600.

However, when I look in my application that same job now has a time of "07 Apr 2010, 18:03". When I print out the Time.zone in a view I get "Athens (UTC +2)", adding an extra hour to the job.

We just switched to summer time about a week ago, but I don't get why the console and webapplication use different Time.zones, while the config.time_zone is defined in both environments.

Is someone having the same problems or had the same experience?

Stijn

If you set Time.zone during a request, you override the default value set in config.time_zone for the length of that request. This would explain the difference in Time.zone values between the console and the browser.

Can you replicate this issue in a bare 2.3.5 app? If so, please file a bug report with the steps to re-create the issue. Without that,my best guess is that the issue is in your app code.

If you set Time.zone during a request, you override the default value

set in config.time_zone for the length of that request. This would

explain the difference in Time.zone values between the console and the

browser.

Can you replicate this issue in a bare 2.3.5 app? If so, please file a

bug report with the steps to re-create the issue. Without that,my best

guess is that the issue is in your app code.

This is Rails-core ML, only meant for discussing Rails-core issues. Please refrain from posting it here.

Anuj