gal
gal

Reputation: 302

how to set timezone for the datetime_select helper

i need some help. i have this code:

<%= f.datetime_select :date,  :start_year => 2011 %>

the output is good except the time zone... the time zone is utc and i want to change him to other time zone. how can i do it? i need to do something in the initializers? i found some stuff on the web but they were in rails 2 and they did not work..

thanks very much, i need a quick help :)

gal harth

i'm stuck with this question please help me!!! :)

Upvotes: 3

Views: 3042

Answers (1)

mkro
mkro

Reputation: 1892

I have this in my rails3 application.rb

# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
config.time_zone = 'Berlin'

would be interested to hear if that helps or if the datetime_select accepts a timezone myself.

And i just found this railscast which may help:

http://railscasts.com/episodes/106-time-zones-in-rails-2-1

Upvotes: 5

Related Questions