Why doesn't "config.time_zone = 'location'" ensure Time.now gives the time back in this time zone?

Hi,

I’m after a way of ensuring all my Time work (e.g. using Time.now)
uses the time zone I define as default. To do this I’ve set the
following line in config/environment.rb:

config.time_zone = ‘Brisbane’

But even after this, if I open up “./script/console” I note that
Time.now doesn’t work. That is I see:

?> Time.now
=> Thu Feb 25 16:45:36 -0800 2010
?>
?> Time.zone.now
=> Fri, 26 Feb 2010 10:45:33 EST +10:00

Is there not a way in rails to ensure any usage of Time.now will give
the time in the configured time_zone, i.e. when used in views /
controllers / ruby files that are in lib but called from controllers
etc?

thanks

think I have it now with:

ENV[‘TZ’] = ‘Australia/Brisbane’

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs