public class Duration
extends BaseDuration
A context-independent duration: days and below, whose length is known without a datum.
DEQUIRKED: toMilliseconds(), getAgo() and getFrom() are now
inherited from BaseDuration (uniform, deterministic, time-preserving); only the
type-preserving arithmetic remains here.
| Constructor and description |
|---|
Duration(int days, int hours, int minutes, int seconds, int millis)Stores the day and time components. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public Duration |
minus(Duration rhs)Subtracts each day and time component of rhs. |
|
public TimeDuration |
minus(TimeDuration rhs)Subtracts each day and time component of rhs and returns a TimeDuration.
|
|
public DatumDependentDuration |
minus(DatumDependentDuration rhs)Subtracts rhs. |
|
public TimeDatumDependentDuration |
minus(TimeDatumDependentDuration rhs)Subtracts rhs. |
|
public Duration |
plus(Duration rhs)Adds each day and time component of rhs. |
|
public Duration |
plus(TimeDuration rhs)Adds this duration to rhs by calling rhs.plus(this),
so the result is a TimeDuration. |
|
public DatumDependentDuration |
plus(DatumDependentDuration rhs)Adds this duration to rhs by calling rhs.plus(this).
|
| Methods inherited from class | Name |
|---|---|
class BaseDuration |
compareTo, getAgo, getDays, getFrom, getHours, getMillis, getMinutes, getMonths, getSeconds, getYears, plus, toMilliseconds, toString |
Stores the day and time components. Years and months stay zero.
days - whole dayshours - hoursminutes - minutesseconds - secondsmillis - milliseconds Subtracts each day and time component of rhs. The components are not normalized.
rhs - duration to subtract Subtracts each day and time component of rhs and returns a TimeDuration.
The components are not normalized.
rhs - duration to subtract Subtracts rhs. Years and months of rhs are negated, and the
day and time components are subtracted. The result is a DatumDependentDuration.
rhs - duration to subtract Subtracts rhs. Years and months of rhs are negated, and the
day and time components are subtracted. The result is a TimeDatumDependentDuration.
rhs - duration to subtract Adds each day and time component of rhs. The components are not normalized.
rhs - duration to add Adds this duration to rhs by calling rhs.plus(this),
so the result is a TimeDuration.
rhs - duration to addrhs computes it Adds this duration to rhs by calling rhs.plus(this).
Years and months stay those of rhs; the day and time components are added.
rhs - duration to addrhs computes itCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.