Duration Methods

Type Method
Duration add(Duration rhs)

Computes a new duration whose value is this+rhs.

int compare(Duration duration)

Partial order relation comparison with this Duration instance.

boolean equals(Object duration)

Checks if this duration object has the same duration as another Duration object.

int getDays()

Obtains the value of the DAYS field as an integer value, or 0 if not present.

int getHours()

Obtains the value of the HOURS field as an integer value, or 0 if not present.

int getMinutes()

Obtains the value of the MINUTES field as an integer value, or 0 if not present.

int getMonths()

Obtains the value of the MONTHS field as an integer value, or 0 if not present.

int getSeconds()

Obtains the value of the SECONDS field as an integer value, or 0 if not present.

int getYears()

Get the years value of this Duration as an int or 0 if not present.

boolean isLongerThan(Duration duration)

Checks if this duration object is strictly longer than another Duration object.

boolean isShorterThan(Duration duration)

Checks if this duration object is strictly shorter than another Duration object.

Duration multiply(BigDecimal factor)

Computes a new duration whose value is factor times longer than the value of this duration.

Duration multiply(int factor)

Computes a new duration whose value is factor times longer than the value of this duration.

Duration subtract(Duration rhs)

Computes a new duration whose value is this-rhs.