Uses of Interface
java.time.temporal.TemporalUnit
Package
Description
The main API for dates, times, instants, and durations.
Generic API for calendar systems other than the default ISO.
Access to date and time using fields and units, and date time adjusters.
-
Uses of TemporalUnit in java.time
Modifier and TypeMethodDescriptionDuration.getUnits()
Gets the set of units supported by this duration.Period.getUnits()
Gets the set of units supported by this period.Modifier and TypeMethodDescriptionlong
Duration.get(TemporalUnit unit)
Gets the value of the requested unit.long
Period.get(TemporalUnit unit)
Gets the value of the requested unit.boolean
Instant.isSupported(TemporalUnit unit)
Checks if the specified unit is supported.boolean
LocalDate.isSupported(TemporalUnit unit)
Checks if the specified unit is supported.boolean
LocalDateTime.isSupported(TemporalUnit unit)
Checks if the specified unit is supported.boolean
LocalTime.isSupported(TemporalUnit unit)
Checks if the specified unit is supported.boolean
OffsetDateTime.isSupported(TemporalUnit unit)
Checks if the specified unit is supported.boolean
OffsetTime.isSupported(TemporalUnit unit)
Checks if the specified unit is supported.boolean
Year.isSupported(TemporalUnit unit)
Checks if the specified unit is supported.boolean
YearMonth.isSupported(TemporalUnit unit)
Checks if the specified unit is supported.boolean
ZonedDateTime.isSupported(TemporalUnit unit)
Checks if the specified unit is supported.Duration.minus(long amountToSubtract, TemporalUnit unit)
Returns a copy of this duration with the specified duration subtracted.Instant.minus(long amountToSubtract, TemporalUnit unit)
Returns a copy of this instant with the specified amount subtracted.LocalDate.minus(long amountToSubtract, TemporalUnit unit)
Returns a copy of this date with the specified amount subtracted.LocalDateTime.minus(long amountToSubtract, TemporalUnit unit)
Returns a copy of this date-time with the specified amount subtracted.LocalTime.minus(long amountToSubtract, TemporalUnit unit)
Returns a copy of this time with the specified amount subtracted.OffsetDateTime.minus(long amountToSubtract, TemporalUnit unit)
Returns a copy of this date-time with the specified amount subtracted.OffsetTime.minus(long amountToSubtract, TemporalUnit unit)
Returns a copy of this time with the specified amount subtracted.Year.minus(long amountToSubtract, TemporalUnit unit)
Returns a copy of this year with the specified amount subtracted.YearMonth.minus(long amountToSubtract, TemporalUnit unit)
Returns a copy of this year-month with the specified amount subtracted.ZonedDateTime.minus(long amountToSubtract, TemporalUnit unit)
Returns a copy of this date-time with the specified amount subtracted.static Duration
Duration.of(long amount, TemporalUnit unit)
Obtains aDuration
representing an amount in the specified unit.Duration.plus(long amountToAdd, TemporalUnit unit)
Returns a copy of this duration with the specified duration added.Instant.plus(long amountToAdd, TemporalUnit unit)
Returns a copy of this instant with the specified amount added.LocalDate.plus(long amountToAdd, TemporalUnit unit)
Returns a copy of this date with the specified amount added.LocalDateTime.plus(long amountToAdd, TemporalUnit unit)
Returns a copy of this date-time with the specified amount added.LocalTime.plus(long amountToAdd, TemporalUnit unit)
Returns a copy of this time with the specified amount added.OffsetDateTime.plus(long amountToAdd, TemporalUnit unit)
Returns a copy of this date-time with the specified amount added.OffsetTime.plus(long amountToAdd, TemporalUnit unit)
Returns a copy of this time with the specified amount added.Year.plus(long amountToAdd, TemporalUnit unit)
Returns a copy of this year with the specified amount added.YearMonth.plus(long amountToAdd, TemporalUnit unit)
Returns a copy of this year-month with the specified amount added.ZonedDateTime.plus(long amountToAdd, TemporalUnit unit)
Returns a copy of this date-time with the specified amount added.Duration.truncatedTo(TemporalUnit unit)
Returns a copy of thisDuration
truncated to the specified unit.Instant.truncatedTo(TemporalUnit unit)
Returns a copy of thisInstant
truncated to the specified unit.LocalDateTime.truncatedTo(TemporalUnit unit)
Returns a copy of thisLocalDateTime
with the time truncated.LocalTime.truncatedTo(TemporalUnit unit)
Returns a copy of thisLocalTime
with the time truncated.OffsetDateTime.truncatedTo(TemporalUnit unit)
Returns a copy of thisOffsetDateTime
with the time truncated.OffsetTime.truncatedTo(TemporalUnit unit)
Returns a copy of thisOffsetTime
with the time truncated.ZonedDateTime.truncatedTo(TemporalUnit unit)
Returns a copy of thisZonedDateTime
with the time truncated.long
Instant.until(Temporal endExclusive, TemporalUnit unit)
Calculates the amount of time until another instant 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
LocalDateTime.until(Temporal endExclusive, TemporalUnit unit)
Calculates the amount of time until another date-time 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.long
OffsetDateTime.until(Temporal endExclusive, TemporalUnit unit)
Calculates the amount of time until another date-time 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
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
ZonedDateTime.until(Temporal endExclusive, TemporalUnit unit)
Calculates the amount of time until another date-time in terms of the specified unit. -
Uses of TemporalUnit in java.time.chrono
Modifier and TypeMethodDescriptionChronoPeriod.getUnits()
Gets the set of units supported by this period.Modifier and TypeMethodDescriptionlong
ChronoPeriod.get(TemporalUnit unit)
Gets the value of the requested unit.default boolean
ChronoLocalDate.isSupported(TemporalUnit unit)
Checks if the specified unit is supported.default boolean
ChronoLocalDateTime.isSupported(TemporalUnit unit)
Checks if the specified unit is supported.default boolean
ChronoZonedDateTime.isSupported(TemporalUnit unit)
Checks if the specified unit is supported.default ChronoLocalDate
ChronoLocalDate.minus(long amountToSubtract, TemporalUnit unit)
Returns an object of the same type as this object with the specified period subtracted.default ChronoLocalDateTime<D>
ChronoLocalDateTime.minus(long amountToSubtract, TemporalUnit unit)
Returns an object of the same type as this object with the specified period subtracted.default ChronoZonedDateTime<D>
ChronoZonedDateTime.minus(long amountToSubtract, TemporalUnit unit)
Returns an object of the same type as this object with the specified period subtracted.HijrahDate.minus(long amountToSubtract, TemporalUnit unit)
JapaneseDate.minus(long amountToAdd, TemporalUnit unit)
MinguoDate.minus(long amountToAdd, TemporalUnit unit)
ThaiBuddhistDate.minus(long amountToAdd, TemporalUnit unit)
default ChronoLocalDate
ChronoLocalDate.plus(long amountToAdd, TemporalUnit unit)
Returns an object of the same type as this object with the specified period added.ChronoLocalDateTime.plus(long amountToAdd, TemporalUnit unit)
Returns an object of the same type as this object with the specified period added.ChronoZonedDateTime.plus(long amountToAdd, TemporalUnit unit)
Returns an object of the same type as this object with the specified period added.HijrahDate.plus(long amountToAdd, TemporalUnit unit)
JapaneseDate.plus(long amountToAdd, TemporalUnit unit)
MinguoDate.plus(long amountToAdd, TemporalUnit unit)
ThaiBuddhistDate.plus(long amountToAdd, TemporalUnit unit)
long
ChronoLocalDate.until(Temporal endExclusive, TemporalUnit unit)
Calculates the amount of time until another date in terms of the specified unit. -
Uses of TemporalUnit in java.time.temporal
Modifier and TypeFieldDescriptionstatic TemporalUnit
IsoFields.QUARTER_YEARS
Unit that represents the concept of a quarter-year.static TemporalUnit
IsoFields.WEEK_BASED_YEARS
The unit that represents week-based-years for the purpose of addition and subtraction.static TemporalUnit
WeekFields.WEEK_BASED_YEARS
The unit that represents week-based-years for the purpose of addition and subtraction.Modifier and TypeMethodDescriptionChronoField.getBaseUnit()
TemporalField.getBaseUnit()
Gets the unit that the field is measured in.ChronoField.getRangeUnit()
TemporalField.getRangeUnit()
Gets the range that the field is bound by.Modifier and TypeMethodDescriptionTemporalAmount.getUnits()
Returns the list of units uniquely defining the value of this TemporalAmount.static TemporalQuery<TemporalUnit>
TemporalQueries.precision()
A query for the smallest supported unit.Modifier and TypeMethodDescriptionlong
TemporalAmount.get(TemporalUnit unit)
Returns the value of the requested unit.boolean
Temporal.isSupported(TemporalUnit unit)
Checks if the specified unit is supported.default Temporal
Temporal.minus(long amountToSubtract, TemporalUnit unit)
Returns an object of the same type as this object with the specified period subtracted.Temporal.plus(long amountToAdd, TemporalUnit unit)
Returns an object of the same type as this object with the specified period added.long
Temporal.until(Temporal endExclusive, TemporalUnit unit)
Calculates the amount of time until another temporal in terms of the specified unit.