Reputation: 7859
I've searched around but cannot find an answer for this.
I have a Duration:
Duration dur = Duration.ofMillis(50);
and I have a DateTime:
DateTime dt = DateTime.now();
How do I subtract the Duration from the DateTime? I can see the method DateTime.Minus(ReadableDuration)
so I thought I could do this:
DateTime dt = DateTime.now().minus(dur);
But apparently Duration does not extend ReadableDuration.
Upvotes: 0
Views: 1408
Reputation: 42010
From the Joda time 2.2 API, the class Duration
implements ReadableDuration
. So, Duration
is a subtype of ReadableDuration
.
public final class Duration
extends BaseDuration
implements ReadableDuration, Serializable
See http://joda-time.sourceforge.net/apidocs/org/joda/time/Duration.html.
Upvotes: 1