On 2 December 2011 19:07, art tav <lists@ruby-forum.com> wrote:
> 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
Colin
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment