Package | Description |
---|---|
java.time |
The main API for dates, times, instants, and durations.
|
java.time.temporal |
Access to date and time using fields and units, additional value type classes and
base support for calendar systems other than the default ISO.
|
Modifier and Type | Method and Description |
---|---|
Instant |
Instant.minus(long amountToSubtract,
TemporalUnit unit)
Returns an object of the same type as this object with the specified period subtracted.
|
LocalTime |
LocalTime.minus(long amountToSubtract,
TemporalUnit unit)
Returns a copy of this time with the specified period subtracted.
|
Duration |
Duration.minus(long amountToSubtract,
TemporalUnit unit)
Returns a copy of this duration with the specified duration subtracted.
|
LocalDateTime |
LocalDateTime.minus(long amountToSubtract,
TemporalUnit unit)
Returns a copy of this date-time with the specified period subtracted.
|
LocalDate |
LocalDate.minus(long amountToSubtract,
TemporalUnit unit)
Returns a copy of this date with the specified period subtracted.
|
ZonedDateTime |
ZonedDateTime.minus(long amountToSubtract,
TemporalUnit unit)
Returns a copy of this date-time with the specified period subtracted.
|
Period |
Period.minus(long amount,
TemporalUnit unit)
Returns a copy of this period with the specified period subtracted.
|
static Duration |
Duration.of(long amount,
TemporalUnit unit)
Obtains an instance of
Duration from a duration in the specified unit. |
static Period |
Period.of(long amount,
TemporalUnit unit)
Obtains an instance of
Period from a period in the specified unit. |
long |
Instant.periodUntil(Temporal endInstant,
TemporalUnit unit)
Calculates the period between this instant and another instant in
terms of the specified unit.
|
long |
LocalTime.periodUntil(Temporal endTime,
TemporalUnit unit)
Calculates the period between this time and another time in
terms of the specified unit.
|
long |
LocalDateTime.periodUntil(Temporal endDateTime,
TemporalUnit unit)
Calculates the period between this date-time and another date-time in
terms of the specified unit.
|
long |
LocalDate.periodUntil(Temporal endDate,
TemporalUnit unit)
Calculates the period between this date and another date in
terms of the specified unit.
|
long |
ZonedDateTime.periodUntil(Temporal endDateTime,
TemporalUnit unit)
Calculates the period between this date-time and another date-time in
terms of the specified unit.
|
Instant |
Instant.plus(long amountToAdd,
TemporalUnit unit)
Returns an object of the same type as this object with the specified period added.
|
LocalTime |
LocalTime.plus(long amountToAdd,
TemporalUnit unit)
Returns a copy of this time with the specified period added.
|
Duration |
Duration.plus(long amountToAdd,
TemporalUnit unit)
Returns a copy of this duration with the specified duration added.
|
LocalDateTime |
LocalDateTime.plus(long amountToAdd,
TemporalUnit unit)
Returns a copy of this date-time with the specified period added.
|
LocalDate |
LocalDate.plus(long amountToAdd,
TemporalUnit unit)
Returns a copy of this date with the specified period added.
|
ZonedDateTime |
ZonedDateTime.plus(long amountToAdd,
TemporalUnit unit)
Returns a copy of this date-time with the specified period added.
|
Period |
Period.plus(long amount,
TemporalUnit unit)
Returns a copy of this period with the specified period added.
|
LocalTime |
LocalTime.truncatedTo(TemporalUnit unit)
Returns a copy of this
LocalTime with the time truncated. |
LocalDateTime |
LocalDateTime.truncatedTo(TemporalUnit unit)
Returns a copy of this
LocalDateTime with the time truncated. |
ZonedDateTime |
ZonedDateTime.truncatedTo(TemporalUnit unit)
Returns a copy of this
ZonedDateTime with the time truncated. |
Modifier and Type | Class and Description |
---|---|
class |
ChronoUnit
A standard set of date periods units.
|
Modifier and Type | Field and Description |
---|---|
static 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.
|
Modifier and Type | Method and Description |
---|---|
TemporalUnit |
TemporalField.getBaseUnit()
Gets the unit that the field is measured in.
|
TemporalUnit |
ChronoField.getBaseUnit() |
TemporalUnit |
TemporalField.getRangeUnit()
Gets the range that the field is bound by.
|
TemporalUnit |
ChronoField.getRangeUnit() |
TemporalUnit |
SimplePeriod.getUnit()
Gets the unit of this period.
|
Modifier and Type | Method and Description |
---|---|
default Temporal |
Temporal.minus(long amountToSubtract,
TemporalUnit unit)
Returns an object of the same type as this object with the specified period subtracted.
|
default ChronoLocalDate<C> |
ChronoLocalDate.minus(long amountToSubtract,
TemporalUnit unit)
Returns an object of the same type as this object with the specified period subtracted.
|
OffsetDate |
OffsetDate.minus(long amountToSubtract,
TemporalUnit unit)
Returns a copy of this date with the specified period subtracted.
|
YearMonth |
YearMonth.minus(long amountToSubtract,
TemporalUnit unit)
Returns an object of the same type as this object with the specified period subtracted.
|
OffsetDateTime |
OffsetDateTime.minus(long amountToSubtract,
TemporalUnit unit)
Returns a copy of this date-time with the specified period subtracted.
|
default ChronoLocalDateTime<C> |
ChronoLocalDateTime.minus(long amountToSubtract,
TemporalUnit unit)
Returns an object of the same type as this object with the specified period subtracted.
|
default ChronoZonedDateTime<C> |
ChronoZonedDateTime.minus(long amountToSubtract,
TemporalUnit unit)
Returns an object of the same type as this object with the specified period subtracted.
|
OffsetTime |
OffsetTime.minus(long amountToSubtract,
TemporalUnit unit)
Returns a copy of this time with the specified period subtracted.
|
Year |
Year.minus(long amountToSubtract,
TemporalUnit unit)
Returns an object of the same type as this object with the specified period subtracted.
|
static SimplePeriod |
SimplePeriod.of(long amount,
TemporalUnit unit)
Obtains an instance of
SimplePeriod from a period in the specified unit. |
long |
Temporal.periodUntil(Temporal endTemporal,
TemporalUnit unit)
Calculates the period between this temporal and another temporal in
terms of the specified unit.
|
long |
ChronoLocalDate.periodUntil(Temporal endDate,
TemporalUnit unit)
Calculates the period between this date and another date in
terms of the specified unit.
|
long |
OffsetDate.periodUntil(Temporal endDate,
TemporalUnit unit)
Calculates the period between this date and another date in
terms of the specified unit.
|
long |
YearMonth.periodUntil(Temporal endYearMonth,
TemporalUnit unit)
Calculates the period between this year-month and another year-month in
terms of the specified unit.
|
long |
OffsetDateTime.periodUntil(Temporal endDateTime,
TemporalUnit unit)
Calculates the period between this date-time and another date-time in
terms of the specified unit.
|
long |
OffsetTime.periodUntil(Temporal endTime,
TemporalUnit unit)
Calculates the period between this time and another time in
terms of the specified unit.
|
long |
Year.periodUntil(Temporal endYear,
TemporalUnit unit)
Calculates the period between this year and another year in
terms of the specified unit.
|
Temporal |
Temporal.plus(long amountToAdd,
TemporalUnit unit)
Returns an object of the same type as this object with the specified period added.
|
default ChronoLocalDate<C> |
ChronoLocalDate.plus(long amountToAdd,
TemporalUnit unit)
Returns an object of the same type as this object with the specified period added.
|
OffsetDate |
OffsetDate.plus(long amountToAdd,
TemporalUnit unit)
Returns a copy of this date with the specified period added.
|
YearMonth |
YearMonth.plus(long amountToAdd,
TemporalUnit unit)
Returns an object of the same type as this object with the specified period added.
|
OffsetDateTime |
OffsetDateTime.plus(long amountToAdd,
TemporalUnit unit)
Returns a copy of this date-time with the specified period added.
|
ChronoLocalDateTime<C> |
ChronoLocalDateTime.plus(long amountToAdd,
TemporalUnit unit)
Returns an object of the same type as this object with the specified period added.
|
ChronoZonedDateTime<C> |
ChronoZonedDateTime.plus(long amountToAdd,
TemporalUnit unit)
Returns an object of the same type as this object with the specified period added.
|
OffsetTime |
OffsetTime.plus(long amountToAdd,
TemporalUnit unit)
Returns a copy of this time with the specified period added.
|
Year |
Year.plus(long amountToAdd,
TemporalUnit unit)
Returns an object of the same type as this object with the specified period added.
|
OffsetDateTime |
OffsetDateTime.truncatedTo(TemporalUnit unit)
Returns a copy of this
OffsetDateTime with the time truncated. |
OffsetTime |
OffsetTime.truncatedTo(TemporalUnit unit)
Returns a copy of this
OffsetTime with the time truncated. |