java.lang.Object | ||
↳ | org.joda.time.base.AbstractDuration | |
↳ | org.joda.time.base.BaseDuration |
Known Direct Subclasses |
BaseDuration is an abstract implementation of ReadableDuration that stores
data in a long
duration milliseconds field.
This class should generally not be used directly by API users.
The ReadableDuration
interface should be used when different
kinds of duration objects are to be referenced.
BaseDuration subclasses may be mutable and not thread-safe.
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a duration from the given millisecond duration.
| |||||||||||
Creates a duration from the given interval endpoints.
| |||||||||||
Creates a duration from the given interval endpoints.
| |||||||||||
Creates a duration from the specified object using the
ConverterManager . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the length of this duration in milliseconds.
| |||||||||||
Converts this duration to an Interval starting at the specified instant.
| |||||||||||
Converts this duration to an Interval ending at the specified instant.
| |||||||||||
Converts this duration to a Period instance using the specified period type
and chronology.
| |||||||||||
Converts this duration to a Period instance using the specified period type
and the ISO chronology.
| |||||||||||
Converts this duration to a Period instance using the standard period type
and the specified chronology.
| |||||||||||
Converts this duration to a Period instance by adding the duration to a start
instant to obtain an interval using the standard period type.
| |||||||||||
Converts this duration to a Period instance by adding the duration to a start
instant to obtain an interval.
| |||||||||||
Converts this duration to a Period instance by subtracting the duration
from an end instant to obtain an interval using the standard period
type.
| |||||||||||
Converts this duration to a Period instance by subtracting the duration
from an end instant to obtain an interval using the standard period
type.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Sets the length of this duration in milliseconds.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.joda.time.base.AbstractDuration
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.lang.Comparable
| |||||||||||
From interface
org.joda.time.ReadableDuration
|
Creates a duration from the given millisecond duration.
duration | the duration, in milliseconds |
---|
Creates a duration from the given interval endpoints.
startInstant | interval start, in milliseconds |
---|---|
endInstant | interval end, in milliseconds |
ArithmeticException | if the duration exceeds a 64 bit long |
---|
Creates a duration from the given interval endpoints.
start | interval start, null means now |
---|---|
end | interval end, null means now |
ArithmeticException | if the duration exceeds a 64 bit long |
---|
Creates a duration from the specified object using the
ConverterManager
.
duration | duration to convert |
---|
IllegalArgumentException | if duration is invalid |
---|
Gets the length of this duration in milliseconds.
Converts this duration to an Interval starting at the specified instant.
startInstant | the instant to start the interval at, null means now |
---|
Converts this duration to an Interval ending at the specified instant.
endInstant | the instant to end the interval at, null means now |
---|
Converts this duration to a Period instance using the specified period type and chronology.
Only precise fields in the period type will be used. Exactly which fields are precise depends on the chronology. Only the time fields are precise for ISO chronology with a time zone. However, ISO UTC also has precise days and weeks.
For more control over the conversion process, you must pair the duration with
an instant, see toPeriodFrom(ReadableInstant, PeriodType)
and
toPeriodTo(ReadableInstant, PeriodType)
type | the period type to use, null means standard |
---|---|
chrono | the chronology to use, null means ISO default |
Converts this duration to a Period instance using the specified period type and the ISO chronology.
Only precise fields in the period type will be used. At most these are hours, minutes, seconds and millis - the period type may restrict the selection further.
For more control over the conversion process, you must pair the duration with
an instant, see toPeriodFrom(ReadableInstant, PeriodType)
.
type | the period type to use, null means standard |
---|
Converts this duration to a Period instance using the standard period type and the specified chronology.
Only precise fields in the period type will be used. Exactly which fields are precise depends on the chronology. Only the time fields are precise for ISO chronology with a time zone. However, ISO UTC also has precise days and weeks.
For more control over the conversion process, you must pair the duration with
an instant, see toPeriodFrom(ReadableInstant)
and
toPeriodTo(ReadableInstant)
chrono | the chronology to use, null means ISO default |
---|
Converts this duration to a Period instance by adding the duration to a start instant to obtain an interval using the standard period type.
This conversion will determine the fields of a period accurately. The results are based on the instant millis, the chronology of the instant, the standard period type and the length of this duration.
startInstant | the instant to calculate the period from, null means now |
---|
Converts this duration to a Period instance by adding the duration to a start instant to obtain an interval.
This conversion will determine the fields of a period accurately. The results are based on the instant millis, the chronology of the instant, the period type and the length of this duration.
startInstant | the instant to calculate the period from, null means now |
---|---|
type | the period type determining how to split the duration into fields, null means All type |
Converts this duration to a Period instance by subtracting the duration from an end instant to obtain an interval using the standard period type.
This conversion will determine the fields of a period accurately. The results are based on the instant millis, the chronology of the instant, the period type and the length of this duration.
endInstant | the instant to calculate the period to, null means now |
---|---|
type | the period type determining how to split the duration into fields, null means All type |
Converts this duration to a Period instance by subtracting the duration from an end instant to obtain an interval using the standard period type.
This conversion will determine the fields of a period accurately. The results are based on the instant millis, the chronology of the instant, the standard period type and the length of this duration.
endInstant | the instant to calculate the period to, null means now |
---|
Sets the length of this duration in milliseconds.
duration | the new length of the duration |
---|