Method: TZInfo::Timezone.get

Defined in:
lib/tzinfo/timezone.rb

.get(identifier) ⇒ Timezone

Returns a time zone by its IANA Time Zone Database identifier (e.g. "Europe/London" or "America/Chicago"). Call all_identifiers for a list of all the valid identifiers.

The get method will return a subclass of TZInfo::Timezone, either a DataTimezone (for a time zone defined by rules that set out when transitions occur) or a LinkedTimezone (for a time zone that is just a link to or alias for a another time zone).

Parameters:

  • identifier (String)

    an IANA Time Zone Database time zone identifier.

Returns:

Raises:



127
128
129
# File 'lib/tzinfo/timezone.rb', line 127

def get(identifier)
  data_source.get_timezone_info(identifier).create_timezone
end