Method: Time.find_zone
- Defined in:
- activesupport/lib/active_support/core_ext/time/zones.rb
.find_zone(time_zone) ⇒ Object
Returns a TimeZone instance matching the time zone provided. Accepts the time zone in any format supported by Time.zone=. Returns nil for invalid time zones.
Time.find_zone "America/New_York" # => #<ActiveSupport::TimeZone @name="America/New_York" ...>
Time.find_zone "NOT-A-TIMEZONE" # => nil
93 94 95 |
# File 'activesupport/lib/active_support/core_ext/time/zones.rb', line 93 def find_zone(time_zone) find_zone!(time_zone) rescue nil end |