Created
July 20, 2012 04:12
-
-
Save selvan/3148639 to your computer and use it in GitHub Desktop.
Timezone & Rails
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
How to configure timezone in Rails | |
==================================== | |
Database table didn't care about timezone's. It just preserves datetime data. | |
Hence it is up to (Rails) applications to manage timezone's. | |
Rails application needs to manage timezone in two ways via configuration - config/application.rb | |
(See http://guides.rubyonrails.org/configuring.html for more details), | |
1. While storing data in DB, which TZ to use | |
> Allows us to use only :local or :utc TZ's | |
> This option can be configured with "config.active_record.default_timezone" | |
2. While displaying data to user which TZ to use | |
> Allows us to use many timezone's ( http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html) | |
> This option can be configured with "config.time_zone" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment