Java compact1, compact2, compact3 java.time.temporal Class TemporalQueries

您所在的位置:网站首页 localdatewith Java compact1, compact2, compact3 java.time.temporal Class TemporalQueries

Java compact1, compact2, compact3 java.time.temporal Class TemporalQueries

2022-12-22 18:34| 来源: 网络整理| 查看: 265

A query for the Chronology.

This queries a TemporalAccessor for the chronology. If the target TemporalAccessor represents a date, or part of a date, then it should return the chronology that the date is expressed in. As a result of this definition, objects only representing time, such as LocalTime, will return null.

The result from JDK classes implementing TemporalAccessor is as follows: LocalDate returns IsoChronology.INSTANCE LocalTime returns null (does not represent a date) LocalDateTime returns IsoChronology.INSTANCE ZonedDateTime returns IsoChronology.INSTANCE OffsetTime returns null (does not represent a date) OffsetDateTime returns IsoChronology.INSTANCE ChronoLocalDate returns the associated chronology ChronoLocalDateTime returns the associated chronology ChronoZonedDateTime returns the associated chronology Era returns the associated chronology DayOfWeek returns null (shared across chronologies) Month returns IsoChronology.INSTANCE Year returns IsoChronology.INSTANCE YearMonth returns IsoChronology.INSTANCE MonthDay returns null IsoChronology.INSTANCE ZoneOffset returns null (does not represent a date) Instant returns null (does not represent a date)

The method Chronology.from(TemporalAccessor) can be used as a TemporalQuery via a method reference, Chronology::from. That method is equivalent to this query, except that it throws an exception if a chronology cannot be obtained.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3