Example usage for Java java.time Duration fields, constructors, methods, implement or subclass
The text is from its open source code.
Duration | ZERO Constant for a duration of zero. |
Duration | abs() Returns a copy of this duration with a positive length. |
Temporal | addTo(Temporal temporal) Adds this duration to the specified temporal object. |
Duration | between(Temporal startInclusive, Temporal endExclusive) Obtains a Duration representing the duration between two temporal objects. |
int | compareTo(Duration otherDuration) Compares this duration to the specified Duration . |
Duration | dividedBy(long divisor) Returns a copy of this duration divided by the specified value. |
long | dividedBy(Duration divisor) Returns number of whole times a specified Duration occurs within this Duration. |
Duration | from(TemporalAmount amount) Obtains an instance of Duration from a temporal amount. |
long | get(TemporalUnit unit) Gets the value of the requested unit. |
int | getNano() Gets the number of nanoseconds within the second in this duration. |
long | getSeconds() Gets the number of seconds in this duration. |
List | getUnits() Gets the set of units supported by this duration. |
int | hashCode() A hash code for this duration. |
boolean | isNegative() Checks if this duration is negative, excluding zero. |
boolean | isZero() Checks if this duration is zero length. |
Duration | minus(Duration duration) Returns a copy of this duration with the specified duration subtracted. |
Duration | minus(long amountToSubtract, TemporalUnit unit) Returns a copy of this duration with the specified duration subtracted. |
Duration | minusDays(long daysToSubtract) Returns a copy of this duration with the specified duration in standard 24 hour days subtracted. |
Duration | minusHours(long hoursToSubtract) Returns a copy of this duration with the specified duration in hours subtracted. |
Duration | minusMillis(long millisToSubtract) Returns a copy of this duration with the specified duration in milliseconds subtracted. |
Duration | minusMinutes(long minutesToSubtract) Returns a copy of this duration with the specified duration in minutes subtracted. |
Duration | minusNanos(long nanosToSubtract) Returns a copy of this duration with the specified duration in nanoseconds subtracted. |
Duration | multipliedBy(long multiplicand) Returns a copy of this duration multiplied by the scalar. |
Duration | negated() Returns a copy of this duration with the length negated. |
Duration | of(long amount, TemporalUnit unit) Obtains a Duration representing an amount in the specified unit. |
Duration | ofDays(long days) Obtains a Duration representing a number of standard 24 hour days. |
Duration | ofHours(long hours) Obtains a Duration representing a number of standard hours. |
Duration | ofMillis(long millis) Obtains a Duration representing a number of milliseconds. |
Duration | ofMinutes(long minutes) Obtains a Duration representing a number of standard minutes. |
Duration | ofNanos(long nanos) Obtains a Duration representing a number of nanoseconds. |
Duration | ofSeconds(long seconds) Obtains a Duration representing a number of seconds. |
Duration | parse(CharSequence text) Obtains a Duration from a text string such as PnDTnHnMn.nS . |
Duration | plus(Duration duration) Returns a copy of this duration with the specified duration added. |
Duration | plus(long amountToAdd, TemporalUnit unit) Returns a copy of this duration with the specified duration added. |
Duration | plus(long secondsToAdd, long nanosToAdd) Returns a copy of this duration with the specified duration added. |
Duration | plusDays(long daysToAdd) Returns a copy of this duration with the specified duration in standard 24 hour days added. |
Duration | plusHours(long hoursToAdd) Returns a copy of this duration with the specified duration in hours added. |
Duration | plusMillis(long millisToAdd) Returns a copy of this duration with the specified duration in milliseconds added. |
Duration | plusMinutes(long minutesToAdd) Returns a copy of this duration with the specified duration in minutes added. |
Duration | plusNanos(long nanosToAdd) Returns a copy of this duration with the specified duration in nanoseconds added. |
Duration | plusSeconds(long secondsToAdd) Returns a copy of this duration with the specified duration in seconds added. |
Temporal | subtractFrom(Temporal temporal) Subtracts this duration from the specified temporal object. |
long | toDays() Gets the number of days in this duration. |
long | toHours() Gets the number of hours in this duration. |
long | toMillis() Converts this duration to the total length in milliseconds. |
long | toMinutes() Gets the number of minutes in this duration. |
long | toNanos() Converts this duration to the total length in nanoseconds expressed as a long . |
String | toString() A string representation of this duration using ISO-8601 seconds based representation, such as PT8H6M12.345S . |
Duration | withNanos(int nanoOfSecond) Returns a copy of this duration with the specified nano-of-second. |
Duration | withSeconds(long seconds) Returns a copy of this duration with the specified amount of seconds. |