class TZInfo::Timezone

The {Timezone} class represents a time zone. It provides a factory method, {get}, to retrieve {Timezone} instances by their identifier.

The {Timezone#to_local} method can be used to convert ‘Time` and `DateTime` instances to the local time for the zone. For example:

tz = TZInfo::Timezone.get('America/New_York')
local_time = tz.to_local(Time.utc(2005,8,29,15,35,0))
local_datetime = tz.to_local(DateTime.new(2005,8,29,15,35,0))

Local ‘Time` and `DateTime` instances returned by `Timezone` have the correct local offset.

The {Timezone#local_to_utc} method can by used to convert local ‘Time` and `DateTime` instances to UTC. {Timezone#local_to_utc} ignores the UTC offset of the supplied value and treats if it is a local time for the zone. For example:

tz = TZInfo::Timezone.get('America/New_York')
utc_time = tz.local_to_utc(Time.new(2005,8,29,11,35,0))
utc_datetime = tz.local_to_utc(DateTime.new(2005,8,29,11,35,0))

Each time zone is treated as sequence of periods of time ({TimezonePeriod}) that observe the same offset ({TimezoneOffset}). Transitions ({TimezoneTransition}) denote the end of one period and the start of the next. The {Timezone} class has methods that allow the periods, offsets and transitions of a time zone to be interrogated.

All methods that take ‘Time` objects as parameters can be used with arbitrary `Time`-like objects that respond to both `to_i` and `subsec` and optionally `utc_offset`.

The {Timezone} class is thread-safe. It is safe to use class and instance methods of {Timezone} in concurrently executing threads. Instances of {Timezone} can be shared across thread boundaries.

The IANA Time Zone Database maintainers recommend that time zone identifiers are not made visible to end-users (see [Names of timezones](data.iana.org/time-zones/theory.html#naming)). The {Country} class can be used to obtain lists of time zones by country, including user-friendly descriptions and approximate locations.

@abstract The {get} method returns an instance of either {DataTimezone} or

{LinkedTimezone}. The {get_proxy} method and other methods returning
collections of time zones return instances of {TimezoneProxy}.