Uses of Class
java.time.ZoneId
-
Packages that use ZoneId Package Description java.time The main API for dates, times, instants, and durations.java.time.chrono Generic API for calendar systems other than the default ISO.java.time.format Provides classes to print and parse dates and times.java.time.temporal Access to date and time using fields and units, and date time adjusters.java.util Contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array). -
-
Uses of ZoneId in java.time
Subclasses of ZoneId in java.time Modifier and Type Class and Description class
ZoneOffset
A time-zone offset from Greenwich/UTC, such as+02:00
.Methods in java.time that return ZoneId Modifier and Type Method and Description static ZoneId
ZoneId. from(TemporalAccessor temporal)
Obtains an instance ofZoneId
from a temporal object.ZoneId
ZonedDateTime. getZone()
Gets the time-zone, such as 'Europe/Paris'.abstract ZoneId
Clock. getZone()
Gets the time-zone being used to create dates and times.ZoneId
ZoneId. normalized()
Normalizes the time-zone ID, returning aZoneOffset
where possible.static ZoneId
ZoneId. of(String zoneId)
Obtains an instance ofZoneId
from an ID ensuring that the ID is valid and available for use.static ZoneId
ZoneId. of(String zoneId, Map<String,String> aliasMap)
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.Methods in java.time with parameters of type ZoneId Modifier and Type Method and Description ZonedDateTime
LocalDate. atStartOfDay(ZoneId zone)
Returns a zoned date-time from this date at the earliest valid time according to the rules in the time-zone.ZonedDateTime
LocalDateTime. atZone(ZoneId zone)
Combines this date-time with a time-zone to create aZonedDateTime
.ZonedDateTime
Instant. atZone(ZoneId zone)
Combines this instant with a time-zone to create aZonedDateTime
.ZonedDateTime
OffsetDateTime. atZoneSameInstant(ZoneId zone)
Combines this date-time with a time-zone to create aZonedDateTime
ensuring that the result has the same instant.ZonedDateTime
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
Clock. fixed(Instant fixedInstant, ZoneId zone)
Obtains a clock that always returns the same instant.static Year
Year. now(ZoneId zone)
Obtains the current year from the system clock in the specified time-zone.static MonthDay
MonthDay. now(ZoneId zone)
Obtains the current month-day from the system clock in the specified time-zone.static YearMonth
YearMonth. now(ZoneId zone)
Obtains the current year-month from the system clock in the specified time-zone.static OffsetTime
OffsetTime. now(ZoneId zone)
Obtains the current time from the system clock in the specified time-zone.static LocalDateTime
LocalDateTime. now(ZoneId zone)
Obtains the current date-time from the system clock in the specified time-zone.static LocalDate
LocalDate. now(ZoneId zone)
Obtains the current date from the system clock in the specified time-zone.static ZonedDateTime
ZonedDateTime. now(ZoneId zone)
Obtains the current date-time from the system clock in the specified time-zone.static OffsetDateTime
OffsetDateTime. now(ZoneId zone)
Obtains the current date-time from the system clock in the specified time-zone.static LocalTime
LocalTime. now(ZoneId zone)
Obtains the current 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
ZonedDateTime. of(LocalDate date, LocalTime time, ZoneId zone)
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 OffsetTime
OffsetTime. ofInstant(Instant instant, ZoneId zone)
Obtains an instance ofOffsetTime
from anInstant
and zone ID.static LocalDateTime
LocalDateTime. ofInstant(Instant instant, ZoneId zone)
Obtains an instance ofLocalDateTime
from anInstant
and zone ID.static ZonedDateTime
ZonedDateTime. ofInstant(Instant instant, ZoneId zone)
Obtains an instance ofZonedDateTime
from anInstant
.static OffsetDateTime
OffsetDateTime. ofInstant(Instant instant, ZoneId zone)
Obtains an instance ofOffsetDateTime
from anInstant
and zone ID.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
Clock. system(ZoneId zone)
Obtains a clock that returns the current instant using best available system clock.static Clock
Clock. tickMinutes(ZoneId zone)
Obtains a clock that returns the current instant ticking in whole minutes using best available system clock.static Clock
Clock. tickSeconds(ZoneId zone)
Obtains a clock that returns the current instant ticking in whole seconds using best available system clock.abstract Clock
Clock. withZone(ZoneId zone)
Returns a copy of this clock with a different time-zone.ZonedDateTime
ZonedDateTime. withZoneSameInstant(ZoneId zone)
Returns a copy of this date-time with a different time-zone, retaining the instant.ZonedDateTime
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
Methods in java.time.chrono that return ZoneId Modifier and Type Method and Description ZoneId
ChronoZonedDateTime. getZone()
Gets the zone ID, such as 'Europe/Paris'.Methods in java.time.chrono with parameters of type ZoneId Modifier and Type Method and Description ChronoZonedDateTime<D>
ChronoLocalDateTime. atZone(ZoneId zone)
Combines this time with a time-zone to create aChronoZonedDateTime
.ThaiBuddhistDate
ThaiBuddhistChronology. dateNow(ZoneId zone)
JapaneseDate
JapaneseChronology. dateNow(ZoneId zone)
HijrahDate
HijrahChronology. dateNow(ZoneId zone)
MinguoDate
MinguoChronology. dateNow(ZoneId zone)
LocalDate
IsoChronology. dateNow(ZoneId zone)
Obtains the current ISO local date from the system clock in the specified time-zone.default ChronoLocalDate
Chronology. dateNow(ZoneId zone)
Obtains the current local date in this chronology from the system clock in the specified time-zone.static ThaiBuddhistDate
ThaiBuddhistDate. now(ZoneId zone)
Obtains the currentThaiBuddhistDate
from the system clock in the specified time-zone.static JapaneseDate
JapaneseDate. now(ZoneId zone)
Obtains the currentJapaneseDate
from the system clock in the specified time-zone.static HijrahDate
HijrahDate. now(ZoneId zone)
Obtains the currentHijrahDate
of the Islamic Umm Al-Qura calendar in the specified time-zone.static MinguoDate
MinguoDate. now(ZoneId zone)
Obtains the currentMinguoDate
from the system clock in the specified time-zone.ChronoZonedDateTime<D>
ChronoZonedDateTime. withZoneSameInstant(ZoneId zone)
Returns a copy of this date-time with a different time-zone, retaining the instant.ChronoZonedDateTime<D>
ChronoZonedDateTime. withZoneSameLocal(ZoneId zone)
Returns a copy of this date-time with a different time-zone, retaining the local date-time if possible.ChronoZonedDateTime<ThaiBuddhistDate>
ThaiBuddhistChronology. zonedDateTime(Instant instant, ZoneId zone)
ChronoZonedDateTime<JapaneseDate>
JapaneseChronology. zonedDateTime(Instant instant, ZoneId zone)
ChronoZonedDateTime<HijrahDate>
HijrahChronology. zonedDateTime(Instant instant, ZoneId zone)
ChronoZonedDateTime<MinguoDate>
MinguoChronology. zonedDateTime(Instant instant, ZoneId zone)
ZonedDateTime
IsoChronology. zonedDateTime(Instant instant, ZoneId zone)
Obtains an ISO zoned date-time in this chronology from anInstant
.default ChronoZonedDateTime<? extends ChronoLocalDate>
Chronology. zonedDateTime(Instant instant, ZoneId zone)
Obtains aChronoZonedDateTime
in this chronology from anInstant
. -
Uses of ZoneId in java.time.format
Methods in java.time.format that return ZoneId Modifier and Type Method and Description ZoneId
DateTimeFormatter. getZone()
Gets the overriding zone to be used during formatting.Methods in java.time.format with parameters of type ZoneId Modifier and Type Method and Description DateTimeFormatter
DateTimeFormatter. withZone(ZoneId zone)
Returns a copy of this formatter with a new override zone.Method parameters in java.time.format with type arguments of type ZoneId Modifier and Type Method and Description DateTimeFormatterBuilder
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
Methods in java.time.temporal that return types with arguments of type ZoneId Modifier and Type Method and Description static 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
Methods in java.util that return ZoneId Modifier and Type Method and Description ZoneId
TimeZone. toZoneId()
Converts thisTimeZone
object to aZoneId
.Methods in java.util with parameters of type ZoneId Modifier and Type Method and Description static TimeZone
TimeZone. getTimeZone(ZoneId zoneId)
Gets theTimeZone
for the givenzoneId
.
-
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2022, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.