# Issue with Time zones

**URL:** <https://discuss.rubyonrails.org/t/issue-with-time-zones/61857>\
**Category:** rubyonrails-talk\
**Created:** [December 2, 2011, 7:07pm UTC](https://discuss.rubyonrails.org/t/issue-with-time-zones/61857 "2011-12-02T19:07:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [December 2, 2011, 7:07pm UTC](https://discuss.rubyonrails.org/t/issue-with-time-zones/61857/1 "2011-12-02T19:07:40Z")

</div>

Hi

I'm having a issue with the time zones in my server I want it to work with Central Time (US & Canada) and I've tried with some ways that i had found but they don't really work the way I want. My last attempt was with this in the environment.rb

config.time\_zone = 'Central Time (US & Canada)'

But when I save a record in the DB it still has the UTC time. I need to modify something in the gem of mysql or what i need to do?

---

<div class="post-metadata">

**Author:** ![Colin\_Law1](https://avatars.discourse-cdn.com/v4/letter/c/91b2a8/32.png) [@Colin\_Law1](https://discuss.rubyonrails.org/u/Colin_Law1)\
**Post date:** [December 2, 2011, 8:43pm UTC](https://discuss.rubyonrails.org/t/issue-with-time-zones/61857/2 "2011-12-02T20:43:38Z")

</div>

> Hi
> 
> I'm having a issue with the time zones in my server I want it to work with Central Time (US & Canada) and I've tried with some ways that i had found but they don't really work the way I want. My last attempt was with this in the environment.rb
> 
> config.time\_zone = 'Central Time (US & Canada)'
> 
> But when I save a record in the DB it still has the UTC time. I need to modify something in the gem of mysql or what i need to do?

You should always save stuff in the db in UTC. Convert it to whatever timezone you want when you display it. If the server is setup in the zone you want then just use @timestamp.localtime. See [http://corelib.rubyonrails.org/classes/Time.html#M000229](http://corelib.rubyonrails.org/classes/Time.html#M000229)

Colin

---

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [December 8, 2011, 10:50pm UTC](https://discuss.rubyonrails.org/t/issue-with-time-zones/61857/3 "2011-12-08T22:50:13Z")

</div>

Oh I see thank you for your help.
