method
find_zone!
v7.1.3.4 -
Show latest stable
-
0 notes -
Class: Time
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (38)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
find_zone!(time_zone)
public
Returns a TimeZone instance matching the time zone provided. Accepts the time zone in any format supported by Time.zone=. Raises an ArgumentError for invalid time zones.
Time.find_zone! "America/New_York" # => #<ActiveSupport::TimeZone @name="America/New_York" ...> Time.find_zone! "EST" # => #<ActiveSupport::TimeZone @name="EST" ...> Time.find_zone! -5.hours # => #<ActiveSupport::TimeZone @name="Bogota" ...> Time.find_zone! nil # => nil Time.find_zone! false # => false Time.find_zone! "NOT-A-TIMEZONE" # => ArgumentError: Invalid Timezone: NOT-A-TIMEZONE