Skip to content

Instantly share code, notes, and snippets.

@yukas
Created April 4, 2015 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yukas/4601086b49fb19824850 to your computer and use it in GitHub Desktop.
Save yukas/4601086b49fb19824850 to your computer and use it in GitHub Desktop.
# Set current application time zone to user's one
def set_time_zone
Time.zone = current_user.time_zone if user_signed_in?
end
# Somewhere in code
Time.zone.now # obtain current time in current user's time zone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment