> I''ve developed a rails application locally (Denmark), and have now
> uploaded it to my server, witch is located in the US.
>
> What didn''t come to my attention in the development face was the
> difference in time zones.
>
> I''v tried setting the "default_timezone"-tag i
environment.rb, but the
> time it still rendered wrong.
The least confusing approach, in my opinion, is to use UTC everywhere.
I assume you mean you have set the default timezone in environment.rb
to :utc.
Consequently, when storing times in the database, you should use
Time.now.utc instead of Time.now.
When displaying times in your views, use a helper to convert from UTC
to the user''s local time zone.
I sympathise with your frustration. Time zones can be fiddly but,
once everything is configured correctly, you can forget about them
(until you deploy your next app on new servers when you won''t be able
to remember quite what you did the previous time to get it all
working :).
If you''ve set Rails up to use UTC and you''re still having
trouble,
it''s worth checking that your app server and database server have
their system clocks and timezones set correctly.... That''s caught me
out in the past and it was infuriating.
Regards,
Andy Stewart
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---