public class Duration
extends java.lang.Object
IllegalStateException
RL Duration also supports static methods for getting the duration as numbers of
hours, days, etc. between 2 calendars (avoiding Duration objects).| Constructor and Description |
|---|
Duration() |
| Modifier and Type | Method and Description |
|---|---|
static javax.xml.datatype.Duration |
between(java.util.Calendar date1,
java.util.Calendar date2)
Compute XML dayTimeDuration between 2 dates.
|
static javax.xml.datatype.Duration |
between(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Compute XML dayTimeDuration between 2 dates.
|
static javax.xml.datatype.Duration |
between(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
Compute XML dayTimeDuration between 2 dates.
|
static javax.xml.datatype.Duration |
between(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Compute XML dayTimeDuration between 2 dates.
|
static int |
compare(java.util.Calendar date1,
java.util.Calendar date2)
Compares two dates and returns an int value
of 0 if they are equal,
less than 0 if date1 represents a point in time before date2,
greater than 0 if date1 represents a point in time after date2.
|
static int |
compare(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Compares two dates and returns an int value
of 0 if they are equal,
less than 0 if date1 represents a point in time before date2,
greater than 0 if date1 represents a point in time after date2.
|
static int |
compare(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
Compares two dates and returns an int value
of 0 if they are equal,
less than 0 if date1 represents a point in time before date2,
greater than 0 if date1 represents a point in time after date2.
|
static int |
compare(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Compares two dates and returns an int value
of 0 if they are equal,
less than 0 if date1 represents a point in time before date2,
greater than 0 if date1 represents a point in time after date2.
|
static int |
compareDurations(javax.xml.datatype.Duration duration1,
javax.xml.datatype.Duration duration2)
compare 2 XML durations.
|
static int |
daysBetween(java.util.Calendar date1,
java.util.Calendar date2) |
static int |
daysBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
days.
|
static int |
daysBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
Returns the difference between the two dates in
days.
|
static int |
daysBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
days.
|
static javax.xml.datatype.Duration |
divide(javax.xml.datatype.Duration dividend,
double divisor)
Divide the given duration by a number
|
static javax.xml.datatype.Duration |
divide(javax.xml.datatype.Duration dividend,
int divisor)
Divide the given duration by a number
|
static javax.xml.datatype.Duration |
fromString(java.lang.String lexicalRepresentation)
create an XML Duration from its lexical representation, e.g.
|
static java.math.BigDecimal |
getSeconds(javax.xml.datatype.Duration xmlDuration)
Get the seconds from the duration as a BigDecimal.
|
static long |
hoursBetween(java.util.Calendar date1,
java.util.Calendar date2)
Returns the difference between the two dates in
hours.
|
static long |
hoursBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
hours.
|
static long |
hoursBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
Returns the difference between the two dates in
hours.
|
static long |
hoursBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
hours.
|
static boolean |
isDayTimeDuration(javax.xml.datatype.Duration xmlDuration)
is the xml duration a dayTimeDuration?
|
static boolean |
isYearMonthDuration(javax.xml.datatype.Duration xmlDuration)
is the xml duration a yearMonthDuration?
|
static long |
millisecondsBetween(java.util.Calendar date1,
java.util.Calendar date2)
Returns the difference between the two dates in
milliseconds.
|
static long |
millisecondsBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
milliseconds.
|
static long |
millisecondsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
Returns the difference between the two dates in
milliseconds.
|
static long |
millisecondsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
milliseconds.
|
static long |
minutesBetween(java.util.Calendar date1,
java.util.Calendar date2)
Returns the difference between the two dates in
minutes.
|
static long |
minutesBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
minutes.
|
static long |
minutesBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
Returns the difference between the two dates in
minutes.
|
static long |
minutesBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
minutes.
|
static int |
monthsBetween(java.util.Calendar date1,
java.util.Calendar date2)
Returns the difference between the two dates in
months.
|
static int |
monthsBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
months.
|
static int |
monthsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
Returns the difference between the two dates in
months.
|
static int |
monthsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
months.
|
static javax.xml.datatype.Duration |
multiply(javax.xml.datatype.Duration duration,
java.math.BigDecimal factor)
Multiply the given duration by a number
|
static javax.xml.datatype.Duration |
multiply(javax.xml.datatype.Duration duration,
int factor)
Multiply the given duration by a number
|
static java.math.BigDecimal |
ratio(javax.xml.datatype.Duration xmlDuration1,
javax.xml.datatype.Duration xmlDuration2)
Divide the first duration by the second duration
|
static long |
secondsBetween(java.util.Calendar date1,
java.util.Calendar date2)
Returns the difference between the two dates in
seconds.
|
static long |
secondsBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
seconds.
|
static long |
secondsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
Returns the difference between the two dates in
seconds.
|
static long |
secondsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
seconds.
|
static int |
weeksBetween(java.util.Calendar date1,
java.util.Calendar date2)
Returns the difference between the two dates in
weeks.
|
static int |
weeksBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
weeks.
|
static int |
weeksBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
Returns the difference between the two dates in
weeks.
|
static int |
weeksBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
weeks.
|
static int |
yearsBetween(java.util.Calendar date1,
java.util.Calendar date2)
Returns the difference between the two dates in
years.
|
static int |
yearsBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
years.
|
static int |
yearsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
Returns the difference between the two dates in
years.
|
static int |
yearsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in
years.
|
public static int yearsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date1 and date2 are converted to
GregorianCalendar before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int yearsBetween(java.util.Calendar date1,
java.util.Calendar date2)
date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int yearsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
date1 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int yearsBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date2 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int monthsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
date1 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int monthsBetween(java.util.Calendar date1,
java.util.Calendar date2)
date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int monthsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date1 and date2 are converted to
GregorianCalendar before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int monthsBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date2 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int weeksBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date1 and date2 are converted to
GregorianCalendar before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int weeksBetween(java.util.Calendar date1,
java.util.Calendar date2)
date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int weeksBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
date1 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int weeksBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date2 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int daysBetween(java.util.Calendar date1,
java.util.Calendar date2)
public static long hoursBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date1 and date2 are converted to
GregorianCalendar before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static long hoursBetween(java.util.Calendar date1,
java.util.Calendar date2)
date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int daysBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date1 and date2 are converted to
GregorianCalendar before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int daysBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
date1 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int daysBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date2 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static long hoursBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
date1 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static long hoursBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date2 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static long minutesBetween(java.util.Calendar date1,
java.util.Calendar date2)
date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static long minutesBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date1 and date2 are converted to
GregorianCalendar before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static long minutesBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
date1 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static long minutesBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date2 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static long secondsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date1 and date2 are converted to
GregorianCalendar before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static long secondsBetween(java.util.Calendar date1,
java.util.Calendar date2)
date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static long secondsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
date1 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static long secondsBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date2 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static long millisecondsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date1 and date2 are converted to
GregorianCalendar before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static long millisecondsBetween(java.util.Calendar date1,
java.util.Calendar date2)
date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static long millisecondsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
date1 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static long millisecondsBetween(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date2 is converted to GregorianCalendar
before the difference is calculated.date1 - date2 - java.lang.NullPointerException - if either date1 or date2 is null.public static int compare(java.util.Calendar date1,
java.util.Calendar date2)
date1 - date2 - public static int compare(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date1 - date2 - public static int compare(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
date1 - date2 - public static int compare(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date1 - date2 - public static javax.xml.datatype.Duration between(java.util.Calendar date1,
java.util.Calendar date2)
date1 - first (earlier) datedate2 - second (later) datepublic static javax.xml.datatype.Duration between(javax.xml.datatype.XMLGregorianCalendar date1,
java.util.Calendar date2)
date1 - first (earlier) datedate2 - second (later) datepublic static javax.xml.datatype.Duration between(java.util.Calendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date1 - first (earlier) datedate2 - second (later) datepublic static javax.xml.datatype.Duration between(javax.xml.datatype.XMLGregorianCalendar date1,
javax.xml.datatype.XMLGregorianCalendar date2)
date1 - first (earlier) datedate2 - second (later) datepublic static javax.xml.datatype.Duration fromString(java.lang.String lexicalRepresentation)
lexicalRepresentation - public static int compareDurations(javax.xml.datatype.Duration duration1,
javax.xml.datatype.Duration duration2)
duration1 - duration2 - java.lang.IllegalStateException - if the durations are not comparable, e.g. one is a dayTimeDuration
and the other is a yearMonthDuration.public static boolean isDayTimeDuration(javax.xml.datatype.Duration xmlDuration)
xmlDuration - public static boolean isYearMonthDuration(javax.xml.datatype.Duration xmlDuration)
xmlDuration - public static java.math.BigDecimal getSeconds(javax.xml.datatype.Duration xmlDuration)
xmlDuration - public static java.math.BigDecimal ratio(javax.xml.datatype.Duration xmlDuration1,
javax.xml.datatype.Duration xmlDuration2)
xmlDuration1 - xmlDuration2 - public static javax.xml.datatype.Duration divide(javax.xml.datatype.Duration dividend,
int divisor)
dividend - divisor - public static javax.xml.datatype.Duration divide(javax.xml.datatype.Duration dividend,
double divisor)
dividend - divisor - public static javax.xml.datatype.Duration multiply(javax.xml.datatype.Duration duration,
int factor)
duration - factor - public static javax.xml.datatype.Duration multiply(javax.xml.datatype.Duration duration,
java.math.BigDecimal factor)
duration - factor -