| org.joda.time.base.BaseDuration org.joda.time.Duration
Duration | final public class Duration extends BaseDuration implements ReadableDuration,Serializable(Code) | | An immutable duration specifying a length of time in milliseconds.
A duration is defined by a fixed number of milliseconds.
There is no concept of fields, such as days or seconds, as these fields can vary in length.
A duration may be converted to a
Period to obtain field values.
This conversion will typically cause a loss of precision however.
Duration is thread-safe and immutable.
author: Brian S O'Neill author: Stephen Colebourne since: 1.0 |
Method Summary | |
public Duration | minus(long amount) Returns a new duration with this length minus that specified. | public Duration | minus(ReadableDuration amount) Returns a new duration with this length minus that specified. | public Duration | plus(long amount) Returns a new duration with this length plus that specified. | public Duration | plus(ReadableDuration amount) Returns a new duration with this length plus that specified. | public Duration | toDuration() Get this duration as an immutable Duration object
by returning this . | public Duration | withDurationAdded(long durationToAdd, int scalar) Returns a new duration with this length plus that specified multiplied by the scalar. | public Duration | withDurationAdded(ReadableDuration durationToAdd, int scalar) Returns a new duration with this length plus that specified multiplied by the scalar. | public Duration | withMillis(long duration) Creates a new Duration instance with a different milisecond length. |
ZERO | final public static Duration ZERO(Code) | | Constant representing zero millisecond duration
|
Duration | public Duration(long duration)(Code) | | Creates a duration from the given millisecond duration.
Parameters: duration - the duration, in milliseconds |
Duration | public Duration(long startInstant, long endInstant)(Code) | | Creates a duration from the given interval endpoints.
Parameters: startInstant - interval start, in milliseconds Parameters: endInstant - interval end, in milliseconds throws: ArithmeticException - if the duration exceeds a 64 bit long |
Duration | public Duration(ReadableInstant start, ReadableInstant end)(Code) | | Creates a duration from the given interval endpoints.
Parameters: start - interval start, null means now Parameters: end - interval end, null means now throws: ArithmeticException - if the duration exceeds a 64 bit long |
minus | public Duration minus(long amount)(Code) | | Returns a new duration with this length minus that specified.
This instance is immutable and is not altered.
If the addition is zero, this instance is returned.
Parameters: amount - the duration to take away from this one the new duration instance |
minus | public Duration minus(ReadableDuration amount)(Code) | | Returns a new duration with this length minus that specified.
This instance is immutable and is not altered.
If the amount is zero, this instance is returned.
Parameters: amount - the duration to take away from this one, null means zero the new duration instance |
plus | public Duration plus(long amount)(Code) | | Returns a new duration with this length plus that specified.
This instance is immutable and is not altered.
If the addition is zero, this instance is returned.
Parameters: amount - the duration to add to this one the new duration instance |
plus | public Duration plus(ReadableDuration amount)(Code) | | Returns a new duration with this length plus that specified.
This instance is immutable and is not altered.
If the amount is zero, this instance is returned.
Parameters: amount - the duration to add to this one, null means zero the new duration instance |
toDuration | public Duration toDuration()(Code) | | Get this duration as an immutable Duration object
by returning this .
this |
withDurationAdded | public Duration withDurationAdded(long durationToAdd, int scalar)(Code) | | Returns a new duration with this length plus that specified multiplied by the scalar.
This instance is immutable and is not altered.
If the addition is zero, this instance is returned.
Parameters: durationToAdd - the duration to add to this one Parameters: scalar - the amount of times to add, such as -1 to subtract once the new duration instance |
withDurationAdded | public Duration withDurationAdded(ReadableDuration durationToAdd, int scalar)(Code) | | Returns a new duration with this length plus that specified multiplied by the scalar.
This instance is immutable and is not altered.
If the addition is zero, this instance is returned.
Parameters: durationToAdd - the duration to add to this one, null means zero Parameters: scalar - the amount of times to add, such as -1 to subtract once the new duration instance |
withMillis | public Duration withMillis(long duration)(Code) | | Creates a new Duration instance with a different milisecond length.
Parameters: duration - the new length of the duration the new duration instance |
|
|