All Implemented Interfaces:
Serializable, Comparable<Duration>, TemporalAmount

  • Field Summary

    Fields

    The maximum supported Duration, which is Long.MAX_VALUE seconds and 999,999,999 nanoseconds.

    Constant for a duration of zero.

  • Method Summary

    abs()

    Returns a copy of this duration with a positive length.

    Adds this duration to the specified temporal object.

    Obtains a Duration representing the duration between two temporal objects.

    int

    Compares this duration to the specified Duration.

    dividedBy(long divisor)

    Returns a copy of this duration divided by the specified value.

    long

    Returns number of whole times a specified Duration occurs within this Duration.

    boolean

    Checks if this duration is equal to the specified Duration.

    Obtains an instance of Duration from a temporal amount.

    long

    Gets the value of the requested unit.

    int

    getNano()

    Gets the number of nanoseconds within the second in this duration.

    long

    Gets the number of seconds in this duration.

    getUnits()

    Gets the set of units supported by this duration.

    int

    hashCode()

    A hash code for this duration.

    boolean

    Checks if this duration is negative, excluding zero.

    boolean

    Checks if this duration is positive, excluding zero.

    boolean

    isZero()

    Checks if this duration is zero length.

    Returns a copy of this duration with the specified duration subtracted.

    Returns a copy of this duration with the specified duration subtracted.

    minusDays(long daysToSubtract)

    Returns a copy of this duration with the specified duration in standard 24 hour days subtracted.

    minusHours(long hoursToSubtract)

    Returns a copy of this duration with the specified duration in hours subtracted.

    minusMillis(long millisToSubtract)

    Returns a copy of this duration with the specified duration in milliseconds subtracted.

    minusMinutes(long minutesToSubtract)

    Returns a copy of this duration with the specified duration in minutes subtracted.

    minusNanos(long nanosToSubtract)

    Returns a copy of this duration with the specified duration in nanoseconds subtracted.

    minusSeconds(long secondsToSubtract)

    Returns a copy of this duration with the specified duration in seconds subtracted.

    multipliedBy(long multiplicand)

    Returns a copy of this duration multiplied by the scalar.

    negated()

    Returns a copy of this duration with the length negated.

    Obtains a Duration representing an amount in the specified unit.

    ofDays(long days)

    Obtains a Duration representing a number of standard 24 hour days.

    ofHours(long hours)

    Obtains a Duration representing a number of standard hours.

    ofMillis(long millis)

    Obtains a Duration representing a number of milliseconds.

    ofMinutes(long minutes)

    Obtains a Duration representing a number of standard minutes.

    ofNanos(long nanos)

    Obtains a Duration representing a number of nanoseconds.

    ofSeconds(long seconds)

    Obtains a Duration representing a number of seconds.

    ofSeconds(long seconds, long nanoAdjustment)

    Obtains a Duration representing a number of seconds and an adjustment in nanoseconds.

    Obtains a Duration from a text string such as PnDTnHnMn.nS.

    Returns a copy of this duration with the specified duration added.

    Returns a copy of this duration with the specified duration added.

    plusDays(long daysToAdd)

    Returns a copy of this duration with the specified duration in standard 24 hour days added.

    plusHours(long hoursToAdd)

    Returns a copy of this duration with the specified duration in hours added.

    plusMillis(long millisToAdd)

    Returns a copy of this duration with the specified duration in milliseconds added.

    plusMinutes(long minutesToAdd)

    Returns a copy of this duration with the specified duration in minutes added.

    plusNanos(long nanosToAdd)

    Returns a copy of this duration with the specified duration in nanoseconds added.

    plusSeconds(long secondsToAdd)

    Returns a copy of this duration with the specified duration in seconds added.

    Subtracts this duration from the specified temporal object.

    long

    toDays()

    Gets the number of days in this duration.

    long

    Extracts the number of days in the duration.

    long

    toHours()

    Gets the number of hours in this duration.

    int

    Extracts the number of hours part in the duration.

    long

    toMillis()

    Converts this duration to the total length in milliseconds.

    int

    Extracts the number of milliseconds part of the duration.

    long

    toMinutes()

    Gets the number of minutes in this duration.

    int

    Extracts the number of minutes part in the duration.

    long

    toNanos()

    Converts this duration to the total length in nanoseconds expressed as a long.

    int

    Get the nanoseconds part within seconds of the duration.

    long

    toSeconds()

    Gets the number of seconds in this duration.

    int

    Extracts the number of seconds part in the duration.

    toString()

    A string representation of this duration using ISO-8601 seconds based representation, such as PT8H6M12.345S.

    Returns a copy of this Duration truncated to the specified unit.

    withNanos(int nanoOfSecond)

    Returns a copy of this duration with the specified nano-of-second.

    withSeconds(long seconds)

    Returns a copy of this duration with the specified amount of seconds.

    Methods declared in class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Creates and returns a copy of this object.

    protected void

    Deprecated, for removal: This API element is subject to removal in a future version.

    Returns the runtime class of this Object.

    final void

    Wakes up a single thread that is waiting on this object's monitor.

    final void

    Wakes up all threads that are waiting on this object's monitor.

    final void

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

    final void

    wait(long timeoutMillis)

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

    final void

    wait(long timeoutMillis, int nanos)

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

  • Field Details

    • ZERO

    • MIN

    • MAX

  • Method Details

    • ofDays

    • ofHours

    • ofMinutes

    • ofSeconds

    • ofSeconds

    • ofMillis

    • ofNanos

    • of

    • from

    • parse

    • between

    • get

    • getUnits

    • isPositive

    • isZero

    • isNegative

    • getSeconds

    • getNano

    • withSeconds

    • withNanos

    • plus

    • plus

    • plusDays

    • plusHours

    • plusMinutes

    • plusSeconds

    • plusMillis

    • plusNanos

    • minus

    • minus

    • minusDays

    • minusHours

    • minusMinutes

    • minusSeconds

    • minusMillis

    • minusNanos

    • multipliedBy

    • dividedBy

    • dividedBy

    • negated

    • abs

    • addTo

    • subtractFrom

    • toDays

    • toHours

    • toMinutes

    • toSeconds

    • toMillis

    • toNanos

    • toDaysPart

    • toHoursPart

    • toMinutesPart

    • toSecondsPart

    • toMillisPart

    • toNanosPart

    • truncatedTo

    • compareTo

    • equals

    • hashCode

    • toString