A map of zone overrides to enable the short time-zone names to be used.
A map of zone overrides to enable the short time-zone names to be used.
Use of short zone IDs has been deprecated in java.util.TimeZone
. This map allows the
IDs to continue to be used via the Map)
factory method.
This map contains a mapping of the IDs that is in line with TZDB 2005r and later, where 'EST', 'MST' and 'HST' map to IDs which do not include daylight savings.
This maps as follows:
The map is unmodifiable.
Obtains an instance of ZoneId
from a temporal object.
Obtains an instance of ZoneId
from a temporal object.
A TemporalAccessor
represents some form of date and time information. This factory
converts the arbitrary temporal object to an instance of ZoneId
.
The conversion will try to obtain the zone in a way that favours region-based zones over
offset-based zones using TemporalQueries#zone()
.
This method matches the signature of the functional interface TemporalQuery
allowing it
to be used in queries via method reference, ZoneId::from
.
the temporal object to convert, not null
the zone ID, not null
DateTimeException
if unable to convert to a { @code ZoneId}
Gets the set of available zone IDs.
Gets the set of available zone IDs.
This set includes the string form of all available region-based IDs. Offset-based zone IDs are
not included in the returned set. The ID can be passed to #of(String)
to create a
ZoneId
.
The set of zone IDs can increase over time, although in a typical application the set of IDs is fixed. Each call to this method is thread-safe.
a modifiable copy of the set of zone IDs, not null
Obtains an instance of ZoneId
from an ID ensuring that the ID is valid and available
for use.
Obtains an instance of ZoneId
from an ID ensuring that the ID is valid and available
for use.
This method parses the ID producing a ZoneId
or ZoneOffset
. A
ZoneOffset
is returned if the ID is 'Z', or starts with '+' or '-'. The result will always be
a valid ID for which ZoneRules
can be obtained.
Parsing matches the zone ID step by step as follows.
ZoneOffset.UTC
.DateTimeException
is thrown.ZoneOffset
using ZoneOffset#of(String)
.ZoneId
with the same ID and rules
equivalent to ZoneOffset.UTC
.ZoneOffset
. The result will be a ZoneId
with the
specified UTC/GMT/UT prefix and the normalized offset ID as per ZoneOffset#getId()
. The
rules of the returned ZoneId
will be equivalent to the parsed ZoneOffset
.[A-Za-z][A-Za-z0-9~/._+-]+
otherwise a DateTimeException
is
thrown. If the zone ID is not in the configured set of IDs, ZoneRulesException
is
thrown. The detailed format of the region ID depends on the group supplying the data. The
default set of data is supplied by the IANA Time Zone Database (TZDB). This has region IDs of
the form '{area}/{city}', such as 'Europe/Paris' or 'America/New_York'. This is compatible with
most IDs from java.util.TimeZone
.
the time-zone ID, not null
the zone ID, not null
DateTimeException
if the zone ID has an invalid format
ZoneRulesException
if the zone ID is a region ID that cannot be found
Obtains an instance of ZoneId
using its ID using a map of aliases to supplement the
standard zone IDs.
Obtains an instance of ZoneId
using its ID using a map of aliases to supplement the
standard zone IDs.
Many users of time-zones use short abbreviations, such as PST for 'Pacific Standard Time' and PDT for 'Pacific Daylight Time'. These abbreviations are not unique, and so cannot be used as IDs. This method allows a map of string to time-zone to be setup and reused within an application.
the time-zone ID, not null
a map of alias zone IDs (typically abbreviations) to real zone IDs, not null
the zone ID, not null
DateTimeException
if the zone ID has an invalid format
ZoneRulesException
if the zone ID is a region ID that cannot be found
Obtains an instance of ZoneId
wrapping an offset.
Obtains an instance of ZoneId
wrapping an offset.
If the prefix is "GMT", "UTC", or "UT" a ZoneId
with the prefix and the non-zero offset
is returned. If the prefix is empty ""
the ZoneOffset
is returned.
the time-zone ID, not null
the offset, not null
the zone ID, not null
IllegalArgumentException
if the prefix is not one of "GMT", "UTC", or "UT", or ""
Gets the system default time-zone.
Gets the system default time-zone.
This queries TimeZone#getDefault()
to find the default time-zone and converts it to a
ZoneId
. If the system default time-zone is changed, then the result of this method will
also change.
the zone ID, not null
DateTimeException
if the converted zone ID has an invalid format
ZoneRulesException
if the converted zone region ID cannot be found