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

**URL:** <https://www.ruby-forum.com/t/why-doesnt-config-time-zone-location-ensure-time-now-gives-the-time-back-in-this-time-zone/184171>\
**Category:** Rails\
**Created:** [February 26, 2010, 1:51am UTC](https://www.ruby-forum.com/t/why-doesnt-config-time-zone-location-ensure-time-now-gives-the-time-back-in-this-time-zone/184171 "2010-02-26T01:51:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![greghauptmann](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e5b9ba/32.png) [@greghauptmann](https://www.ruby-forum.com/u/greghauptmann)\
**Post date:** [February 26, 2010, 1:51am UTC](https://www.ruby-forum.com/t/why-doesnt-config-time-zone-location-ensure-time-now-gives-the-time-back-in-this-time-zone/184171/1 "2010-02-26T01:51:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![greghauptmann](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e5b9ba/32.png) [@greghauptmann](https://www.ruby-forum.com/u/greghauptmann)\
**Post date:** [February 26, 2010, 2:05am UTC](https://www.ruby-forum.com/t/why-doesnt-config-time-zone-location-ensure-time-now-gives-the-time-back-in-this-time-zone/184171/2 "2010-02-26T02:05:02Z")

</div>

think I have it now with:

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