Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Business Rules
11g Release 1 (11.1.1)

E10663-03


oracle.rules.rl.extensions
Class Duration

java.lang.Object
  extended by oracle.rules.rl.extensions.Duration

Direct Known Subclasses:
OracleDuration

public class Duration
extends java.lang.Object

RL Duration supports xml schema yearMonthDuration or dayTimeDuration. You cannot mix yearMonthDuration and dayTimeDuration. Doing so may result in IllegalStateException RL Duration also supports static methods for getting the duration as numbers of hours, days, etc. between 2 calendars (avoiding Duration objects).


Constructor Summary
Duration()
           

 

Method Summary
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 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.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

Duration

public Duration()

Method Detail

yearsBetween

public static int yearsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                               javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in years. The difference may be negative if date1 is later than date2. Any resulting fractional year is truncated. date1 and date2 are converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of years between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

yearsBetween

public static int yearsBetween(java.util.Calendar date1,
                               java.util.Calendar date2)
Returns the difference between the two dates in years. The difference may be negative if date1 is later than date2. Any resulting fractional year is truncated.
Parameters:
date1 -
date2 -
Returns:
the number of years between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

yearsBetween

public static int yearsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                               java.util.Calendar date2)
Returns the difference between the two dates in years. The difference may be negative if date1 is later than date2. Any resulting fractional year is truncated. date1 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of years between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

yearsBetween

public static int yearsBetween(java.util.Calendar date1,
                               javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in years. The difference may be negative if date1 is later than date2. Any resulting fractional year is truncated. date2 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of years between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

monthsBetween

public static int monthsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                                java.util.Calendar date2)
Returns the difference between the two dates in months. The difference may be negative if date1 is later than date2. Any resulting fractional month is truncated. date1 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of months between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

monthsBetween

public static int monthsBetween(java.util.Calendar date1,
                                java.util.Calendar date2)
Returns the difference between the two dates in months. The difference may be negative if date1 is later than date2. Any resulting fractional month is truncated.
Parameters:
date1 -
date2 -
Returns:
the number of months between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

monthsBetween

public static int monthsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                                javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in months. The difference may be negative if date1 is later than date2. Any resulting fractional month is truncated. date1 and date2 are converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of months between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

monthsBetween

public static int monthsBetween(java.util.Calendar date1,
                                javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in months. The difference may be negative if date1 is later than date2. Any resulting fractional month is truncated. date2 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of months between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

weeksBetween

public static int weeksBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                               javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in weeks. The difference may be negative if date1 is later than date2. Any resulting fractional week is truncated. date1 and date2 are converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of weeks between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

weeksBetween

public static int weeksBetween(java.util.Calendar date1,
                               java.util.Calendar date2)
Returns the difference between the two dates in weeks. The difference may be negative if date1 is later than date2. Any resulting fractional week is truncated.
Parameters:
date1 -
date2 -
Returns:
the number of weeks between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

weeksBetween

public static int weeksBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                               java.util.Calendar date2)
Returns the difference between the two dates in weeks. The difference may be negative if date1 is later than date2. Any resulting fractional week is truncated. date1 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of weeks between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

weeksBetween

public static int weeksBetween(java.util.Calendar date1,
                               javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in weeks. The difference may be negative if date1 is later than date2. Any resulting fractional week is truncated. date2 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of weeks between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

daysBetween

public static int daysBetween(java.util.Calendar date1,
                              java.util.Calendar date2)

hoursBetween

public static long hoursBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                                javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in hours. The difference may be negative if date1 is later than date2. Any resulting fractional hour is truncated. date1 and date2 are converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of hours between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

hoursBetween

public static long hoursBetween(java.util.Calendar date1,
                                java.util.Calendar date2)
Returns the difference between the two dates in hours. The difference may be negative if date1 is later than date2. Any resulting fractional hour is truncated.
Parameters:
date1 -
date2 -
Returns:
the number of hours between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

daysBetween

public static int daysBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                              javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in days. The difference may be negative if date1 is later than date2. Any resulting fractional day is truncated. date1 and date2 are converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of days between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

daysBetween

public static int daysBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                              java.util.Calendar date2)
Returns the difference between the two dates in days. The difference may be negative if date1 is later than date2. Any resulting fractional day is truncated. date1 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of days between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

daysBetween

public static int daysBetween(java.util.Calendar date1,
                              javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in days. The difference may be negative if date1 is later than date2. Any resulting fractional day is truncated. date2 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of days between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

hoursBetween

public static long hoursBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                                java.util.Calendar date2)
Returns the difference between the two dates in hours. The difference may be negative if date1 is later than date2. Any resulting fractional hour is truncated. date1 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of hours between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

hoursBetween

public static long hoursBetween(java.util.Calendar date1,
                                javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in hours. The difference may be negative if date1 is later than date2. Any resulting fractional hour is truncated. date2 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of hours between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

minutesBetween

public static long minutesBetween(java.util.Calendar date1,
                                  java.util.Calendar date2)
Returns the difference between the two dates in minutes. The difference may be negative if date1 is later than date2. Any resulting fractional minute is truncated.
Parameters:
date1 -
date2 -
Returns:
the number of minutes between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

minutesBetween

public static long minutesBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                                  javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in minutes. The difference may be negative if date1 is later than date2. Any resulting fractional minute is truncated. date1 and date2 are converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of minutes between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

minutesBetween

public static long minutesBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                                  java.util.Calendar date2)
Returns the difference between the two dates in minutes. The difference may be negative if date1 is later than date2. Any resulting fractional minute is truncated. date1 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of minutes between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

minutesBetween

public static long minutesBetween(java.util.Calendar date1,
                                  javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in minutes. The difference may be negative if date1 is later than date2. Any resulting fractional minute is truncated. date2 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of minutes between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

secondsBetween

public static long secondsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                                  javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in seconds. The difference may be negative if date1 is later than date2. Any resulting fractional second is truncated. date1 and date2 are converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of seconds between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

secondsBetween

public static long secondsBetween(java.util.Calendar date1,
                                  java.util.Calendar date2)
Returns the difference between the two dates in seconds. The difference may be negative if date1 is later than date2. Any resulting fractional second is truncated.
Parameters:
date1 -
date2 -
Returns:
the number of seconds between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

secondsBetween

public static long secondsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                                  java.util.Calendar date2)
Returns the difference between the two dates in seconds. The difference may be negative if date1 is later than date2. Any resulting fractional second is truncated. date1 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of seconds between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

secondsBetween

public static long secondsBetween(java.util.Calendar date1,
                                  javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in seconds. The difference may be negative if date1 is later than date2. Any resulting fractional second is truncated. date2 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of seconds between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

millisecondsBetween

public static long millisecondsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                                       javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in milliseconds. The difference may be negative if date1 is later than date2. date1 and date2 are converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of milliseconds between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

millisecondsBetween

public static long millisecondsBetween(java.util.Calendar date1,
                                       java.util.Calendar date2)
Returns the difference between the two dates in milliseconds. The difference may be negative if date1 is later than date2.
Parameters:
date1 -
date2 -
Returns:
the number of milliseconds between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

millisecondsBetween

public static long millisecondsBetween(javax.xml.datatype.XMLGregorianCalendar date1,
                                       java.util.Calendar date2)
Returns the difference between the two dates in milliseconds. The difference may be negative if date1 is later than date2. date1 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of milliseconds between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

millisecondsBetween

public static long millisecondsBetween(java.util.Calendar date1,
                                       javax.xml.datatype.XMLGregorianCalendar date2)
Returns the difference between the two dates in milliseconds. The difference may be negative if date1 is later than date2. date2 is converted to GregorianCalendar before the difference is calculated.
Parameters:
date1 -
date2 -
Returns:
the number of milliseconds between the date1 and date2.
Throws:
java.lang.NullPointerException - if either date1 or date2 is null.

compare

public static int compare(java.util.Calendar date1,
                          java.util.Calendar date2)
Compares two dates and returns an int value
Parameters:
date1 -
date2 -
Returns:
the relative comparison result.

compare

public static int compare(javax.xml.datatype.XMLGregorianCalendar date1,
                          javax.xml.datatype.XMLGregorianCalendar date2)
Compares two dates and returns an int value
Parameters:
date1 -
date2 -
Returns:
the relative comparison result.

compare

public static int compare(javax.xml.datatype.XMLGregorianCalendar date1,
                          java.util.Calendar date2)
Compares two dates and returns an int value
Parameters:
date1 -
date2 -
Returns:
the relative comparison result.

compare

public static int compare(java.util.Calendar date1,
                          javax.xml.datatype.XMLGregorianCalendar date2)
Compares two dates and returns an int value
Parameters:
date1 -
date2 -
Returns:
the relative comparison result.

between

public static javax.xml.datatype.Duration between(java.util.Calendar date1,
                                                  java.util.Calendar date2)
Compute XML dayTimeDuration between 2 dates. Result will be negative if date1 > date2.
Parameters:
date1 - first (earlier) date
date2 - second (later) date
Returns:
XML Duration

between

public static javax.xml.datatype.Duration between(javax.xml.datatype.XMLGregorianCalendar date1,
                                                  java.util.Calendar date2)
Compute XML dayTimeDuration between 2 dates. Result will be negative if date1 > date2.
Parameters:
date1 - first (earlier) date
date2 - second (later) date
Returns:
XML Duration

between

public static javax.xml.datatype.Duration between(java.util.Calendar date1,
                                                  javax.xml.datatype.XMLGregorianCalendar date2)
Compute XML dayTimeDuration between 2 dates. Result will be negative if date1 > date2.
Parameters:
date1 - first (earlier) date
date2 - second (later) date
Returns:
XML Duration

between

public static javax.xml.datatype.Duration between(javax.xml.datatype.XMLGregorianCalendar date1,
                                                  javax.xml.datatype.XMLGregorianCalendar date2)
Compute XML dayTimeDuration between 2 dates. Result will be negative if date1 > date2.
Parameters:
date1 - first (earlier) date
date2 - second (later) date
Returns:
XML Duration

fromString

public static javax.xml.datatype.Duration fromString(java.lang.String lexicalRepresentation)
create an XML Duration from its lexical representation, e.g. P7DT6H is 7 days 6 hours.
Parameters:
lexicalRepresentation -
Returns:

compareDurations

public static int compareDurations(javax.xml.datatype.Duration duration1,
                                   javax.xml.datatype.Duration duration2)
compare 2 XML durations.
Parameters:
duration1 -
duration2 -
Returns:
-1, 0, or +1 depending on whether duration1 is <, ==, or > duration2, respectively.
Throws:
java.lang.IllegalStateException - if the durations are not comparable, e.g. one is a dayTimeDuration and the other is a yearMonthDuration.

isDayTimeDuration

public static boolean isDayTimeDuration(javax.xml.datatype.Duration xmlDuration)
is the xml duration a dayTimeDuration?
Parameters:
xmlDuration -
Returns:
boolean

isYearMonthDuration

public static boolean isYearMonthDuration(javax.xml.datatype.Duration xmlDuration)
is the xml duration a yearMonthDuration?
Parameters:
xmlDuration -
Returns:
boolean

getSeconds

public static java.math.BigDecimal getSeconds(javax.xml.datatype.Duration xmlDuration)
Get the seconds from the duration as a BigDecimal.
Parameters:
xmlDuration -
Returns:
seconds, including fractional part

ratio

public static java.math.BigDecimal ratio(javax.xml.datatype.Duration xmlDuration1,
                                         javax.xml.datatype.Duration xmlDuration2)
Divide the first duration by the second duration
Parameters:
xmlDuration1 -
xmlDuration2 -
Returns:
BigDecimal quotient

divide

public static javax.xml.datatype.Duration divide(javax.xml.datatype.Duration dividend,
                                                 int divisor)
Divide the given duration by a number
Parameters:
dividend -
divisor -
Returns:
Duration

divide

public static javax.xml.datatype.Duration divide(javax.xml.datatype.Duration dividend,
                                                 double divisor)
Divide the given duration by a number
Parameters:
dividend -
divisor -
Returns:
Duration

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Business Rules
11g Release 1 (11.1.1)

E10663-03


Copyright © 2010, Oracle and/or its affiliates. All rights reserved.