Uses of Class
java.time.ZoneId
Package
Description
The main API for dates, times, instants, and durations.
Generic API for calendar systems other than the default ISO.
Provides classes to print and parse dates and times.
Access to date and time using fields and units, and date time adjusters.
Contains the collections framework, some internationalization support classes,
a service loader, properties, random number generation, string parsing
and scanning classes, base64 encoding and decoding, a bit array, and
several miscellaneous utility classes.
-
Uses of ZoneId in java.time
Modifier and TypeClassDescriptionfinal class
A time-zone offset from Greenwich/UTC, such as+02:00
.Modifier and TypeMethodDescriptionstatic ZoneId
ZoneId.from
(TemporalAccessor temporal) Obtains an instance ofZoneId
from a temporal object.abstract ZoneId
Clock.getZone()
Gets the time-zone being used to create dates and times.ZonedDateTime.getZone()
Gets the time-zone, such as 'Europe/Paris'.ZoneId.normalized()
Normalizes the time-zone ID, returning aZoneOffset
where possible.static ZoneId
Obtains an instance ofZoneId
from an ID ensuring that the ID is valid and available for use.static ZoneId
Obtains an instance ofZoneId
using its ID using a map of aliases to supplement the standard zone IDs.static ZoneId
ZoneId.ofOffset
(String prefix, ZoneOffset offset) Obtains an instance ofZoneId
wrapping an offset.static ZoneId
ZoneId.systemDefault()
Gets the system default time-zone.Modifier and TypeMethodDescriptionLocalDate.atStartOfDay
(ZoneId zone) Returns a zoned date-time from this date at the earliest valid time according to the rules in the time-zone.Combines this instant with a time-zone to create aZonedDateTime
.Combines this date-time with a time-zone to create aZonedDateTime
.OffsetDateTime.atZoneSameInstant
(ZoneId zone) Combines this date-time with a time-zone to create aZonedDateTime
ensuring that the result has the same instant.OffsetDateTime.atZoneSimilarLocal
(ZoneId zone) Combines this date-time with a time-zone to create aZonedDateTime
trying to keep the same local date and time.static Clock
Obtains a clock that always returns the same instant.static LocalDate
Obtains the current date from the system clock in the specified time-zone.static LocalDateTime
Obtains the current date-time from the system clock in the specified time-zone.static LocalTime
Obtains the current time from the system clock in the specified time-zone.static MonthDay
Obtains the current month-day from the system clock in the specified time-zone.static OffsetDateTime
Obtains the current date-time from the system clock in the specified time-zone.static OffsetTime
Obtains the current time from the system clock in the specified time-zone.static Year
Obtains the current year from the system clock in the specified time-zone.static YearMonth
Obtains the current year-month from the system clock in the specified time-zone.static ZonedDateTime
Obtains the current date-time from the system clock in the specified time-zone.static ZonedDateTime
ZonedDateTime.of
(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, ZoneId zone) Obtains an instance ofZonedDateTime
from a year, month, day, hour, minute, second, nanosecond and time-zone.static ZonedDateTime
Obtains an instance ofZonedDateTime
from a local date and time.static ZonedDateTime
ZonedDateTime.of
(LocalDateTime localDateTime, ZoneId zone) Obtains an instance ofZonedDateTime
from a local date-time.static LocalDate
Obtains an instance ofLocalDate
from anInstant
and zone ID.static LocalDateTime
Obtains an instance ofLocalDateTime
from anInstant
and zone ID.static LocalTime
Obtains an instance ofLocalTime
from anInstant
and zone ID.static OffsetDateTime
Obtains an instance ofOffsetDateTime
from anInstant
and zone ID.static OffsetTime
Obtains an instance ofOffsetTime
from anInstant
and zone ID.static ZonedDateTime
Obtains an instance ofZonedDateTime
from anInstant
.static ZonedDateTime
ZonedDateTime.ofInstant
(LocalDateTime localDateTime, ZoneOffset offset, ZoneId zone) Obtains an instance ofZonedDateTime
from the instant formed by combining the local date-time and offset.static ZonedDateTime
ZonedDateTime.ofLocal
(LocalDateTime localDateTime, ZoneId zone, ZoneOffset preferredOffset) Obtains an instance ofZonedDateTime
from a local date-time using the preferred offset if possible.static ZonedDateTime
ZonedDateTime.ofStrict
(LocalDateTime localDateTime, ZoneOffset offset, ZoneId zone) Obtains an instance ofZonedDateTime
strictly validating the combination of local date-time, offset and zone ID.static Clock
Obtains a clock that returns the current instant using the best available system clock.static Clock
Clock.tickMillis
(ZoneId zone) Obtains a clock that returns the current instant ticking in whole milliseconds using the best available system clock.static Clock
Clock.tickMinutes
(ZoneId zone) Obtains a clock that returns the current instant ticking in whole minutes using the best available system clock.static Clock
Clock.tickSeconds
(ZoneId zone) Obtains a clock that returns the current instant ticking in whole seconds using the best available system clock.abstract Clock
Returns a copy of this clock with a different time-zone.default Clock
Returns a clock with the specified time-zone.ZonedDateTime.withZoneSameInstant
(ZoneId zone) Returns a copy of this date-time with a different time-zone, retaining the instant.ZonedDateTime.withZoneSameLocal
(ZoneId zone) Returns a copy of this date-time with a different time-zone, retaining the local date-time if possible. -
Uses of ZoneId in java.time.chrono
Modifier and TypeMethodDescriptionChronoZonedDateTime.getZone()
Gets the zone ID, such as 'Europe/Paris'.Modifier and TypeMethodDescriptionCombines this time with a time-zone to create aChronoZonedDateTime
.default ChronoLocalDate
Obtains the current local date in this chronology from the system clock in the specified time-zone.Obtains the current ISO local date from the system clock in the specified time-zone.static HijrahDate
Obtains the currentHijrahDate
of the Islamic Umm Al-Qura calendar in the specified time-zone.static JapaneseDate
Obtains the currentJapaneseDate
from the system clock in the specified time-zone.static MinguoDate
Obtains the currentMinguoDate
from the system clock in the specified time-zone.static ThaiBuddhistDate
Obtains the currentThaiBuddhistDate
from the system clock in the specified time-zone.ChronoZonedDateTime.withZoneSameInstant
(ZoneId zone) Returns a copy of this date-time with a different time-zone, retaining the instant.ChronoZonedDateTime.withZoneSameLocal
(ZoneId zone) Returns a copy of this date-time with a different time-zone, retaining the local date-time if possible.default ChronoZonedDateTime<? extends ChronoLocalDate>
Chronology.zonedDateTime
(Instant instant, ZoneId zone) Obtains aChronoZonedDateTime
in this chronology from anInstant
.HijrahChronology.zonedDateTime
(Instant instant, ZoneId zone) IsoChronology.zonedDateTime
(Instant instant, ZoneId zone) Obtains an ISO zoned date-time in this chronology from anInstant
.JapaneseChronology.zonedDateTime
(Instant instant, ZoneId zone) MinguoChronology.zonedDateTime
(Instant instant, ZoneId zone) ThaiBuddhistChronology.zonedDateTime
(Instant instant, ZoneId zone) -
Uses of ZoneId in java.time.format
Modifier and TypeMethodDescriptionDateTimeFormatter.getZone()
Gets the overriding zone to be used during formatting.Modifier and TypeMethodDescriptionReturns a copy of this formatter with a new override zone.Modifier and TypeMethodDescriptionDateTimeFormatterBuilder.appendGenericZoneText
(TextStyle textStyle, Set<ZoneId> preferredZones) Appends the generic time-zone name, such as 'Pacific Time', to the formatter.DateTimeFormatterBuilder.appendZoneText
(TextStyle textStyle, Set<ZoneId> preferredZones) Appends the time-zone name, such as 'British Summer Time', to the formatter. -
Uses of ZoneId in java.time.temporal
Modifier and TypeMethodDescriptionstatic TemporalQuery<ZoneId>
TemporalQueries.zone()
A lenient query for theZoneId
, falling back to theZoneOffset
.static TemporalQuery<ZoneId>
TemporalQueries.zoneId()
A strict query for theZoneId
. -
Uses of ZoneId in java.util
Modifier and TypeMethodDescriptionstatic TimeZone
TimeZone.getTimeZone
(ZoneId zoneId) Gets theTimeZone
for the givenzoneId
.