Java™ Platform
Standard Ed. 8

Uses of Interface
java.time.temporal.Temporal

  • Packages that use Temporal 
    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.temporal
    Access to date and time using fields and units, and date time adjusters.
    • Uses of Temporal in java.time

      Classes in java.time that implement Temporal 
      Modifier and Type Class and Description
      class  Instant
      An instantaneous point on the time-line.
      class  LocalDate
      A date without a time-zone in the ISO-8601 calendar system, such as 2007-12-03.
      class  LocalDateTime
      A date-time without a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30.
      class  LocalTime
      A time without a time-zone in the ISO-8601 calendar system, such as 10:15:30.
      class  OffsetDateTime
      A date-time with an offset from UTC/Greenwich in the ISO-8601 calendar system, such as 2007-12-03T10:15:30+01:00.
      class  OffsetTime
      A time with an offset from UTC/Greenwich in the ISO-8601 calendar system, such as 10:15:30+01:00.
      class  Year
      A year in the ISO-8601 calendar system, such as 2007.
      class  YearMonth
      A year-month in the ISO-8601 calendar system, such as 2007-12.
      class  ZonedDateTime
      A date-time with a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30+01:00 Europe/Paris.
      Methods in java.time that return Temporal 
      Modifier and Type Method and Description
      Temporal Period.addTo(Temporal temporal)
      Adds this period to the specified temporal object.
      Temporal Duration.addTo(Temporal temporal)
      Adds this duration to the specified temporal object.
      Temporal Year.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have this year.
      Temporal MonthDay.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have this month-day.
      Temporal YearMonth.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have this year-month.
      Temporal DayOfWeek.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have this day-of-week.
      Temporal Month.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have this month-of-year.
      Temporal OffsetTime.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same offset and time as this object.
      Temporal LocalDateTime.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same date and time as this object.
      Temporal LocalDate.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same date as this object.
      Temporal OffsetDateTime.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same offset, date and time as this object.
      Temporal ZoneOffset.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same offset as this object.
      Temporal Instant.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have this instant.
      Temporal LocalTime.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same time as this object.
      Temporal Period.subtractFrom(Temporal temporal)
      Subtracts this period from the specified temporal object.
      Temporal Duration.subtractFrom(Temporal temporal)
      Subtracts this duration from the specified temporal object.
      Methods in java.time with parameters of type Temporal 
      Modifier and Type Method and Description
      Temporal Period.addTo(Temporal temporal)
      Adds this period to the specified temporal object.
      Temporal Duration.addTo(Temporal temporal)
      Adds this duration to the specified temporal object.
      Temporal Year.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have this year.
      Temporal MonthDay.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have this month-day.
      Temporal YearMonth.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have this year-month.
      Temporal DayOfWeek.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have this day-of-week.
      Temporal Month.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have this month-of-year.
      Temporal OffsetTime.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same offset and time as this object.
      Temporal LocalDateTime.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same date and time as this object.
      Temporal LocalDate.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same date as this object.
      Temporal OffsetDateTime.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same offset, date and time as this object.
      Temporal ZoneOffset.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same offset as this object.
      Temporal Instant.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have this instant.
      Temporal LocalTime.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same time as this object.
      static Duration Duration.between(Temporal startInclusive, Temporal endExclusive)
      Obtains a Duration representing the duration between two temporal objects.
      Temporal Period.subtractFrom(Temporal temporal)
      Subtracts this period from the specified temporal object.
      Temporal Duration.subtractFrom(Temporal temporal)
      Subtracts this duration from the specified temporal object.
      long Year.until(Temporal endExclusive, TemporalUnit unit)
      Calculates the amount of time until another year in terms of the specified unit.
      long YearMonth.until(Temporal endExclusive, TemporalUnit unit)
      Calculates the amount of time until another year-month in terms of the specified unit.
      long OffsetTime.until(Temporal endExclusive, TemporalUnit unit)
      Calculates the amount of time until another time in terms of the specified unit.
      long LocalDateTime.until(Temporal endExclusive, TemporalUnit unit)
      Calculates the amount of time until another date-time in terms of the specified unit.
      long LocalDate.until(Temporal endExclusive, TemporalUnit unit)
      Calculates the amount of time until another date in terms of the specified unit.
      long ZonedDateTime.until(Temporal endExclusive, TemporalUnit unit)
      Calculates the amount of time until another date-time in terms of the specified unit.
      long OffsetDateTime.until(Temporal endExclusive, TemporalUnit unit)
      Calculates the amount of time until another date-time in terms of the specified unit.
      long Instant.until(Temporal endExclusive, TemporalUnit unit)
      Calculates the amount of time until another instant in terms of the specified unit.
      long LocalTime.until(Temporal endExclusive, TemporalUnit unit)
      Calculates the amount of time until another time in terms of the specified unit.
    • Uses of Temporal in java.time.chrono

      Subinterfaces of Temporal in java.time.chrono 
      Modifier and Type Interface and Description
      interface  ChronoLocalDate
      A date without time-of-day or time-zone in an arbitrary chronology, intended for advanced globalization use cases.
      interface  ChronoLocalDateTime<D extends ChronoLocalDate>
      A date-time without a time-zone in an arbitrary chronology, intended for advanced globalization use cases.
      interface  ChronoZonedDateTime<D extends ChronoLocalDate>
      A date-time with a time-zone in an arbitrary chronology, intended for advanced globalization use cases.
      Classes in java.time.chrono that implement Temporal 
      Modifier and Type Class and Description
      class  HijrahDate
      A date in the Hijrah calendar system.
      class  JapaneseDate
      A date in the Japanese Imperial calendar system.
      class  MinguoDate
      A date in the Minguo calendar system.
      class  ThaiBuddhistDate
      A date in the Thai Buddhist calendar system.
      Methods in java.time.chrono that return Temporal 
      Modifier and Type Method and Description
      Temporal ChronoPeriod.addTo(Temporal temporal)
      Adds this period to the specified temporal object.
      default Temporal Era.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same era as this object.
      default Temporal ChronoLocalDateTime.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same date and time as this object.
      default Temporal ChronoLocalDate.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same date as this object.
      Temporal ChronoPeriod.subtractFrom(Temporal temporal)
      Subtracts this period from the specified temporal object.
      Methods in java.time.chrono with parameters of type Temporal 
      Modifier and Type Method and Description
      Temporal ChronoPeriod.addTo(Temporal temporal)
      Adds this period to the specified temporal object.
      default Temporal Era.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same era as this object.
      default Temporal ChronoLocalDateTime.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same date and time as this object.
      default Temporal ChronoLocalDate.adjustInto(Temporal temporal)
      Adjusts the specified temporal object to have the same date as this object.
      Temporal ChronoPeriod.subtractFrom(Temporal temporal)
      Subtracts this period from the specified temporal object.
      long ChronoLocalDate.until(Temporal endExclusive, TemporalUnit unit)
      Calculates the amount of time until another date in terms of the specified unit.
    • Uses of Temporal in java.time.temporal

      Methods in java.time.temporal with type parameters of type Temporal 
      Modifier and Type Method and Description
      <R extends Temporal>
      R
      TemporalUnit.addTo(R temporal, long amount)
      Returns a copy of the specified temporal object with the specified period added.
      <R extends Temporal>
      R
      ChronoUnit.addTo(R temporal, long amount) 
      <R extends Temporal>
      R
      TemporalField.adjustInto(R temporal, long newValue)
      Returns a copy of the specified temporal object with the value of this field set.
      <R extends Temporal>
      R
      ChronoField.adjustInto(R temporal, long newValue) 
      Methods in java.time.temporal that return Temporal 
      Modifier and Type Method and Description
      Temporal TemporalAmount.addTo(Temporal temporal)
      Adds to the specified temporal object.
      Temporal TemporalAdjuster.adjustInto(Temporal temporal)
      Adjusts the specified temporal object.
      default Temporal Temporal.minus(long amountToSubtract, TemporalUnit unit)
      Returns an object of the same type as this object with the specified period subtracted.
      default Temporal Temporal.minus(TemporalAmount amount)
      Returns an object of the same type as this object with an amount subtracted.
      Temporal Temporal.plus(long amountToAdd, TemporalUnit unit)
      Returns an object of the same type as this object with the specified period added.
      default Temporal Temporal.plus(TemporalAmount amount)
      Returns an object of the same type as this object with an amount added.
      Temporal TemporalAmount.subtractFrom(Temporal temporal)
      Subtracts this object from the specified temporal object.
      default Temporal Temporal.with(TemporalAdjuster adjuster)
      Returns an adjusted object of the same type as this object with the adjustment made.
      Temporal Temporal.with(TemporalField field, long newValue)
      Returns an object of the same type as this object with the specified field altered.
      Methods in java.time.temporal with parameters of type Temporal 
      Modifier and Type Method and Description
      Temporal TemporalAmount.addTo(Temporal temporal)
      Adds to the specified temporal object.
      Temporal TemporalAdjuster.adjustInto(Temporal temporal)
      Adjusts the specified temporal object.
      long TemporalUnit.between(Temporal temporal1Inclusive, Temporal temporal2Exclusive)
      Calculates the amount of time between two temporal objects.
      long ChronoUnit.between(Temporal temporal1Inclusive, Temporal temporal2Exclusive) 
      default boolean TemporalUnit.isSupportedBy(Temporal temporal)
      Checks if this unit is supported by the specified temporal object.
      boolean ChronoUnit.isSupportedBy(Temporal temporal) 
      Temporal TemporalAmount.subtractFrom(Temporal temporal)
      Subtracts this object from the specified temporal object.
      long Temporal.until(Temporal endExclusive, TemporalUnit unit)
      Calculates the amount of time until another temporal in terms of the specified unit.
Java™ Platform
Standard Ed. 8

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.

微信小程序

微信扫一扫体验

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部