类的用途
java.time.ZoneId
使用 ZoneId 的包
包
描述
日期、时间、瞬间和持续时间的主要 API。
用于除默认 ISO 之外的日历系统的通用 API。
提供类来打印和解析日期和时间。
使用字段和单位以及日期时间调整器访问日期和时间。
包含集合框架、一些国际化支持类、服务加载器、属性、随机数生成、字符串解析和扫描类、base64 编码和解码、位数组和几个杂项实用程序类。
-
ZoneId 在 java.time 中的用法
修饰符和类型方法描述static ZoneIdZoneId.from(TemporalAccessor temporal) 从时间对象中获取ZoneId的实例。abstract ZoneIdClock.getZone()获取用于创建日期和时间的时区。ZonedDateTime.getZone()获取时区,例如“欧洲/巴黎”。ZoneId.normalized()规范化时区 ID,尽可能返回ZoneOffset。static ZoneId从 ID 中获取ZoneId的实例,确保该 ID 有效且可供使用。static ZoneId使用别名映射来补充标准区域 ID,使用其 ID 获取ZoneId的实例。static ZoneIdZoneId.ofOffset(String prefix, ZoneOffset offset) 获得ZoneId包装偏移量的实例。static ZoneIdZoneId.systemDefault()获取系统默认时区。修饰符和类型方法描述LocalDate.atStartOfDay(ZoneId zone) 根据时区规则,从该日期开始的最早有效时间返回分区日期时间。将这个时刻与时区结合起来创建一个ZonedDateTime。将此日期时间与时区组合以创建ZonedDateTime。OffsetDateTime.atZoneSameInstant(ZoneId zone) 将此日期时间与时区组合以创建ZonedDateTime确保结果具有相同的时刻。OffsetDateTime.atZoneSimilarLocal(ZoneId zone) 将此日期时间与时区组合以创建一个ZonedDateTime试图保持相同的本地日期和时间。static Clock获得始终返回同一时刻的时钟。static LocalDate从指定时区的系统时钟获取当前日期。static LocalDateTime从指定时区的系统时钟获取当前日期时间。static LocalTime从指定时区的系统时钟获取当前时间。static MonthDay从指定时区的系统时钟获取当前月-日。static OffsetDateTime从指定时区的系统时钟获取当前日期时间。static OffsetTime从指定时区的系统时钟获取当前时间。static Year从指定时区的系统时钟获取当前年份。static YearMonth从指定时区的系统时钟获取当前年月。static ZonedDateTime从指定时区的系统时钟获取当前日期时间。static ZonedDateTimeZonedDateTime.of(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, ZoneId zone) 从年、月、日、小时、分钟、秒、纳秒和时区获取ZonedDateTime的实例。static ZonedDateTime从本地日期和时间获取ZonedDateTime的实例。static ZonedDateTimeZonedDateTime.of(LocalDateTime localDateTime, ZoneId zone) 从本地日期时间获取ZonedDateTime的实例。static LocalDate从Instant和区域 ID 获取LocalDate的实例。static LocalDateTime从Instant和区域 ID 获取LocalDateTime的实例。static LocalTime从Instant和区域 ID 获取LocalTime的实例。static OffsetDateTime从Instant和区域 ID 获取OffsetDateTime的实例。static OffsetTime从Instant和区域 ID 获取OffsetTime的实例。static ZonedDateTime从Instant获得ZonedDateTime的实例。static ZonedDateTimeZonedDateTime.ofInstant(LocalDateTime localDateTime, ZoneOffset offset, ZoneId zone) 从结合本地日期时间和偏移量形成的瞬间获得ZonedDateTime的实例。static ZonedDateTimeZonedDateTime.ofLocal(LocalDateTime localDateTime, ZoneId zone, ZoneOffset preferredOffset) 如果可能,使用首选偏移量从本地日期时间获取ZonedDateTime的实例。static ZonedDateTimeZonedDateTime.ofStrict(LocalDateTime localDateTime, ZoneOffset offset, ZoneId zone) 获取ZonedDateTime的实例,严格验证本地日期时间、偏移量和区域 ID 的组合。static Clock使用最佳可用系统时钟获取返回当前时刻的时钟。static ClockClock.tickMillis(ZoneId zone) 获得一个时钟,该时钟使用最佳可用系统时钟以整毫秒返回当前的即时滴答声。static ClockClock.tickMinutes(ZoneId zone) 获得一个时钟,该时钟使用最佳可用系统时钟以整分钟返回当前即时滴答声。static ClockClock.tickSeconds(ZoneId zone) 使用最佳可用系统时钟获取一个时钟,该时钟以整秒为单位返回当前即时滴答声。abstract Clock返回具有不同时区的此时钟的副本。default Clock返回具有指定时区的时钟。ZonedDateTime.withZoneSameInstant(ZoneId zone) 返回具有不同时区的此日期时间的副本,保留瞬间。ZonedDateTime.withZoneSameLocal(ZoneId zone) 返回具有不同时区的此日期时间的副本,如果可能,保留本地日期时间。 -
ZoneId 在 java.time.chrono 中的用法
java.time.chrono 中返回 ZoneId 的方法java.time.chrono 中的方法,参数类型为 ZoneId修饰符和类型方法描述将这个时间与时区结合起来创建一个ChronoZonedDateTime。default ChronoLocalDate从指定时区的系统时钟获取此年表中的当前本地日期。从指定时区的系统时钟获取当前 ISO 本地日期。static HijrahDate获取指定时区的伊斯兰 Umm Al-Qura 日历的当前HijrahDate。static JapaneseDate从指定时区的系统时钟获取当前JapaneseDate。static MinguoDate从指定时区的系统时钟获取当前MinguoDate。static ThaiBuddhistDate从指定时区的系统时钟获取当前ThaiBuddhistDate。ChronoZonedDateTime.withZoneSameInstant(ZoneId zone) 返回具有不同时区的此日期时间的副本,保留瞬间。ChronoZonedDateTime.withZoneSameLocal(ZoneId zone) 返回具有不同时区的此日期时间的副本,如果可能,保留本地日期时间。default ChronoZonedDateTime<? extends ChronoLocalDate>Chronology.zonedDateTime(Instant instant, ZoneId zone) 从Instant获得此年表中的ChronoZonedDateTime。HijrahChronology.zonedDateTime(Instant instant, ZoneId zone) IsoChronology.zonedDateTime(Instant instant, ZoneId zone) 从Instant获取此年表中的 ISO 分区日期时间。JapaneseChronology.zonedDateTime(Instant instant, ZoneId zone) MinguoChronology.zonedDateTime(Instant instant, ZoneId zone) ThaiBuddhistChronology.zonedDateTime(Instant instant, ZoneId zone) -
ZoneId 在 java.time.format 中的用法
java.time.format 中返回 ZoneId 的方法java.time.format 中的方法,参数类型为 ZoneIdjava.time.format 中的方法参数,类型参数为 ZoneId修饰符和类型方法描述DateTimeFormatterBuilder.appendGenericZoneText(TextStyle textStyle, Set<ZoneId> preferredZones) 将通用时区名称(例如“太平洋时间”)附加到格式化程序。DateTimeFormatterBuilder.appendZoneText(TextStyle textStyle, Set<ZoneId> preferredZones) 将时区名称(例如“英国夏令时”)附加到格式化程序。 -
ZoneId 在 java.time.temporal 中的用法
返回类型中包含 ZoneId 类型参数的 java.time.temporal 中的方法修饰符和类型方法描述static TemporalQuery<ZoneId>TemporalQueries.zone()对ZoneId的宽松查询,返回到ZoneOffset。static TemporalQuery<ZoneId>TemporalQueries.zoneId()对ZoneId的严格查询。 -
ZoneId 在 java.util 中的用法