object ZoneId extends Serializable
- Alphabetic
- By Inheritance
- ZoneId
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
lazy val
SHORT_IDS: Map[String, String]
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 theMap)
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:
- EST - -05:00
- HST - -10:00
- MST - -07:00
- ACT - Australia/Darwin
- AET - Australia/Sydney
- AGT - America/Argentina/Buenos_Aires
- ART - Africa/Cairo
- AST - America/Anchorage
- BET - America/Sao_Paulo
- BST - Asia/Dhaka
- CAT - Africa/Harare
- CNT - America/St_Johns
- CST - America/Chicago
- CTT - Asia/Shanghai
- EAT - Africa/Addis_Ababa
- ECT - Europe/Paris
- IET - America/Indiana/Indianapolis
- IST - Asia/Kolkata
- JST - Asia/Tokyo
- MIT - Pacific/Apia
- NET - Asia/Yerevan
- NST - Pacific/Auckland
- PLT - Asia/Karachi
- PNT - America/Phoenix
- PRT - America/Puerto_Rico
- PST - America/Los_Angeles
- SST - Pacific/Guadalcanal
- VST - Asia/Ho_Chi_Minh
The map is unmodifiable.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
from(temporal: TemporalAccessor): ZoneId
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 ofZoneId
.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
.- temporal
the temporal object to convert, not null
- returns
the zone ID, not null
- Exceptions thrown
DateTimeException
if unable to convert to a { @code ZoneId}
-
def
getAvailableZoneIds: Set[String]
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 aZoneId
.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.
- returns
a modifiable copy of the set of zone IDs, not null
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
of(zoneId: String): ZoneId
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
orZoneOffset
. AZoneOffset
is returned if the ID is 'Z', or starts with '+' or '-'. The result will always be a valid ID for whichZoneRules
can be obtained.Parsing matches the zone ID step by step as follows.
- If the zone ID equals 'Z', the result is
ZoneOffset.UTC
. - If the zone ID consists of a single letter, the zone ID is invalid
and
DateTimeException
is thrown. - If the zone ID starts with '+' or '-', the ID is parsed as a
ZoneOffset
usingZoneOffset#of(String)
. - If the zone ID equals 'GMT', 'UTC' or 'UT' then the result is a
ZoneId
with the same ID and rules equivalent toZoneOffset.UTC
. - If the zone ID starts with 'UTC+', 'UTC-', 'GMT+', 'GMT-', 'UT+' or 'UT-'
then the ID is a prefixed offset-based ID. The ID is split in two, with
a two or three letter prefix and a suffix starting with the sign.
The suffix is parsed as a
ZoneOffset
. The result will be aZoneId
with the specified UTC/GMT/UT prefix and the normalized offset ID as perZoneOffset#getId()
. The rules of the returnedZoneId
will be equivalent to the parsedZoneOffset
. - All other IDs are parsed as region-based zone IDs. Region IDs must
match the regular expression
[A-Za-z][A-Za-z0-9~/._+-]+
otherwise aDateTimeException
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 fromjava.util.TimeZone
.
- zoneId
the time-zone ID, not null
- returns
the zone ID, not null
- Exceptions thrown
DateTimeException
if the zone ID has an invalid formatZoneRulesException
if the zone ID is a region ID that cannot be found
- If the zone ID equals 'Z', the result is
-
def
of(zoneId: String, aliasMap: Map[String, String]): ZoneId
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.
- zoneId
the time-zone ID, not null
- aliasMap
a map of alias zone IDs (typically abbreviations) to real zone IDs, not null
- returns
the zone ID, not null
- Exceptions thrown
DateTimeException
if the zone ID has an invalid formatZoneRulesException
if the zone ID is a region ID that cannot be found
-
def
ofOffset(prefix: String, offset: ZoneOffset): ZoneId
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""
theZoneOffset
is returned.- prefix
the time-zone ID, not null
- offset
the offset, not null
- returns
the zone ID, not null
- Exceptions thrown
IllegalArgumentException
if the prefix is not one of "GMT", "UTC", or "UT", or ""
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
systemDefault: ZoneId
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 aZoneId
. If the system default time-zone is changed, then the result of this method will also change.- returns
the zone ID, not null
- Exceptions thrown
DateTimeException
if the converted zone ID has an invalid formatZoneRulesException
if the converted zone region ID cannot be found
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()