Sums this TimeSpan with an object that can be converted to a
TimeSpan.
Sums this TimeSpan with an object that can be converted to a
TimeSpan. If either TimeSpan represents a Duration, add the
Durations directly. If both TimeSpans represents a Period (which is
deprecated behavior), adds them using Period addition.
A TimeSpan representing the sum of this span and in's
TimeSpan representation.
UnsupportedOperationException If only one of the two TimeSpans
represents a Period and that Period has a year or month
component (this only occurs if the deprecated months or
years builders are used, as month and year lengths in
milliseconds are only defined with respect to a reference point,
since the length of a month or year can vary)
Adding two TimeSpans where both were constructed using the
deprecated months or years builders will result in a TimeSpan
representing a Period. These TimeSpans can behave in unexpected
ways, including throwing exceptions when their millisecond duration
is required.
Adding two TimeSpans where one of the two was constructed using the
deprecated months or years builders will throw an exception.
Subtracts an object that can be converted to a TimeSpan from this
TimeSpan.
Subtracts an object that can be converted to a TimeSpan from this
TimeSpan. If either TimeSpan represents a Duration, subtracts the
Durations directly. If both TimeSpans represents a Period (which is
deprecated behavior), subtracts them using Period subtraction.
A TimeSpan representing the sum of this span and in's
TimeSpan representation.
UnsupportedOperationException If only one of the two TimeSpans
represents a Period and that Period has a year or month
component (this only occurs if the deprecated months or
years builders are used, as month and year lengths in
milliseconds are only defined with respect to a reference point,
since the length of a month or year can vary)
Subtracting two TimeSpans where both were constructed using the
deprecated months or years builders will result in a TimeSpan
representing a Period. These TimeSpans can behave in unexpected
ways, including throwing exceptions when their millisecond duration
is required.
Subtracting two TimeSpans where one of the two was constructed
using the deprecated months or years builders will throw an
exception.
Override the equals method so that TimeSpans can be compared to long, int,
Joda-Time Duration, and TimeSpan.
Override the equals method so that TimeSpans can be compared to long, int,
Joda-Time Duration, and TimeSpan.
Comparing to a Joda-Time Period is also done correctly, but is
deprecated.
The amount of milliseconds this TimeSpan represents.
UnsupportedOperationException When created by the deprecated months/years builder (
month and year lengths in milliseconds are only defined with respect to a reference point,
since the length of a month or year can vary).
Alias for +.
The amount of milliseconds this TimeSpan represents.
UnsupportedOperationException When created by the deprecated
months/years builder (month and year lengths in milliseconds
are only defined with respect to a reference point, since the
length of a month or year can vary).
Override the toString method to display a readable amount of time using
TimeSpan.format
Override the toString method to display a readable amount of time using
TimeSpan.format
Convert to a Java Date.
Convert to a Java Date. The number of milliseconds in the Duration
will be added to the UNIX epoch to create a Date object.
(Since version 3.0.0) This method will be removed due to its unclear behavior; use new Date(timeSpan.millis) instead.
Convert to a Java Date.
Convert to a Java Date. Synonym of date.
(Since version 3.0.0) This method will be removed due to its unclear behavior; use new Date(timeSpan.millis) instead.
Convert to a Joda-Time DateTime.
Convert to a Joda-Time DateTime. The number of milliseconds in the Duration
will be added to the UNIX epoch to create a DateTime object.
(Since version 3.0.0) This method will be removed due to its unclear behavior; use new DateTime(timeSpan.millis) instead.
The
TimeSpanclass represents a duration of time in milliseconds. In this way, it is similar to thescala.concurrent.Durationclass. It is mostly used in Lift APIs in similar positions as the ScalaDurationclass (for example, in event scheduling).Unlike in the Lift 2.x series, building a
TimeSpanwith aLongwill not have different behavior depending on the value passed. Any passedLongwill be used as a duration.Prior to Lift 3.0,
TimeSpanwas an amalgam of duration and jodaDateTime, and allowed conversions between the two. As a result, operational semantics were poorly defined and it was easy to call a method that seemed like it should have simple duration semantics but run intoDateTimesemantics that made things more complicated instead.Lift 3.0 mostly maintains API compatibility with the Lift 2.x series, but introduces a series of deprecations to indicate places where dangerous and potentially unclear behavior may occur. Lift 3.1 will maintain API compatibility with all non-deprecated parts of the
TimeSpanAPI, but will remove the deprecated aspects.For deprecated years and month builders it handle an operations on duration field values. Then it could be used only in to-period implicit conversion.