Created
June 12, 2010 14:48
-
-
Save krasio/435789 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/environment.rb | |
# setting default timezone for your app when firing up Rails | |
config.time_zone = 'UTC' | |
# app/controllers/application_controller.rb | |
# changing timezone to one selected by user if logged in | |
before_filter :set_time_zone | |
def set_time_zone | |
Time.zone = current_user.time_zone if logged_in? | |
end | |
# bunch of useful methods in http://apidock.com/rails/DateTime | |
# http://apidock.com/rails/DateTime/in_time_zone | |
# http://apidock.com/rails/DateTime/utc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment