Interval

INTERVAL representation for result sets.

Methods
static Interval ofDays(long days)
Creates a new INTERVAL DAY.
static Interval ofDays(long days)
Creates a new INTERVAL DAY.
Parameters:
days - days, |days|<1018
Returns:
INTERVAL DAY
static Interval ofDaysHours(long days, int hours)
Creates a new INTERVAL DAY TO HOUR.
static Interval ofDaysHours(long days, int hours)
Creates a new INTERVAL DAY TO HOUR.

If both arguments are not equal to zero they should have the same sign.

Parameters:
days - days, |days|<1018
hours - hours, |hours|<24
Returns:
INTERVAL DAY TO HOUR
static Interval ofDaysHoursMinutes(long days, int hours, int minutes)
Creates a new INTERVAL DAY TO MINUTE.
static Interval ofDaysHoursMinutes(long days, int hours, int minutes)
Creates a new INTERVAL DAY TO MINUTE.

Non-zero arguments should have the same sign.

Parameters:
days - days, |days|<1018
hours - hours, |hours|<24
minutes - minutes, |minutes|<60
Returns:
INTERVAL DAY TO MINUTE
static Interval ofDaysHoursMinutesNanos(long days, int hours, int minutes, long nanos)
Creates a new INTERVAL DAY TO SECOND.
static Interval ofDaysHoursMinutesNanos(long days, int hours, int minutes, long nanos)
Creates a new INTERVAL DAY TO SECOND.

Non-zero arguments should have the same sign.

Parameters:
days - days, |days|<1018
hours - hours, |hours|<24
minutes - minutes, |minutes|<60
nanos - nanoseconds, |nanos|<60,000,000,000
Returns:
INTERVAL DAY TO SECOND
static Interval ofDaysHoursMinutesSeconds(long days, int hours, int minutes, int seconds)
Creates a new INTERVAL DAY TO SECOND.
static Interval ofDaysHoursMinutesSeconds(long days, int hours, int minutes, int seconds)
Creates a new INTERVAL DAY TO SECOND.

Non-zero arguments should have the same sign.

Parameters:
days - days, |days|<1018
hours - hours, |hours|<24
minutes - minutes, |minutes|<60
seconds - seconds, |seconds|<60
Returns:
INTERVAL DAY TO SECOND
static Interval ofHours(long hours)
Creates a new INTERVAL HOUR.
static Interval ofHours(long hours)
Creates a new INTERVAL HOUR.
Parameters:
hours - hours, |hours|<1018
Returns:
INTERVAL HOUR
static Interval ofHoursMinutes(long hours, int minutes)
Creates a new INTERVAL HOUR TO MINUTE.
static Interval ofHoursMinutes(long hours, int minutes)
Creates a new INTERVAL HOUR TO MINUTE.

If both arguments are not equal to zero they should have the same sign.

Parameters:
hours - hours, |hours|<1018
minutes - minutes, |minutes|<60
Returns:
INTERVAL HOUR TO MINUTE
static Interval ofHoursMinutesNanos(long hours, int minutes, long nanos)
Creates a new INTERVAL HOUR TO SECOND.
static Interval ofHoursMinutesNanos(long hours, int minutes, long nanos)
Creates a new INTERVAL HOUR TO SECOND.

Non-zero arguments should have the same sign.

Parameters:
hours - hours, |hours|<1018
minutes - minutes, |minutes|<60
nanos - nanoseconds, |seconds|<60,000,000,000
Returns:
INTERVAL HOUR TO SECOND
static Interval ofHoursMinutesSeconds(long hours, int minutes, int seconds)
Creates a new INTERVAL HOUR TO SECOND.
static Interval ofHoursMinutesSeconds(long hours, int minutes, int seconds)
Creates a new INTERVAL HOUR TO SECOND.

Non-zero arguments should have the same sign.

Parameters:
hours - hours, |hours|<1018
minutes - minutes, |minutes|<60
seconds - seconds, |seconds|<60
Returns:
INTERVAL HOUR TO SECOND
static Interval ofMinutes(long minutes)
Creates a new INTERVAL MINUTE.
static Interval ofMinutes(long minutes)
Creates a new INTERVAL MINUTE.
Parameters:
minutes - minutes, |minutes|<1018
Returns:
interval
static Interval ofMinutesNanos(long minutes, long nanos)
Creates a new INTERVAL MINUTE TO SECOND.
static Interval ofMinutesNanos(long minutes, long nanos)
Creates a new INTERVAL MINUTE TO SECOND.

If both arguments are not equal to zero they should have the same sign.

Parameters:
minutes - minutes, |minutes|<1018
nanos - nanoseconds, |nanos|<60,000,000,000
Returns:
INTERVAL MINUTE TO SECOND
static Interval ofMinutesSeconds(long minutes, int seconds)
Creates a new INTERVAL MINUTE TO SECOND.
static Interval ofMinutesSeconds(long minutes, int seconds)
Creates a new INTERVAL MINUTE TO SECOND.

If both arguments are not equal to zero they should have the same sign.

Parameters:
minutes - minutes, |minutes|<1018
seconds - seconds, |seconds|<60
Returns:
INTERVAL MINUTE TO SECOND
static Interval ofMonths(long months)
Creates a new INTERVAL MONTH.
static Interval ofMonths(long months)
Creates a new INTERVAL MONTH.
Parameters:
months - months, |months|<1018
Returns:
INTERVAL MONTH
static Interval ofNanos(long nanos)
Creates a new INTERVAL SECOND.
static Interval ofNanos(long nanos)
Creates a new INTERVAL SECOND.
Parameters:
nanos - nanoseconds (including seconds)
Returns:
INTERVAL SECOND
static Interval ofSeconds(long seconds)
Creates a new INTERVAL SECOND.
static Interval ofSeconds(long seconds)
Creates a new INTERVAL SECOND.
Parameters:
seconds - seconds, |seconds|<1018
Returns:
INTERVAL SECOND
static Interval ofSeconds(long seconds, int nanos)
Creates a new INTERVAL SECOND.
static Interval ofSeconds(long seconds, int nanos)
Creates a new INTERVAL SECOND.

If both arguments are not equal to zero they should have the same sign.

Parameters:
seconds - seconds, |seconds|<1018
nanos - nanoseconds, |nanos|<1,000,000,000
Returns:
INTERVAL SECOND
static Interval ofYears(long years)
Creates a new INTERVAL YEAR.
static Interval ofYears(long years)
Creates a new INTERVAL YEAR.
Parameters:
years - years, |years|<1018
Returns:
INTERVAL YEAR
static Interval ofYearsMonths(long years, int months)
Creates a new INTERVAL YEAR TO MONTH.
static Interval ofYearsMonths(long years, int months)
Creates a new INTERVAL YEAR TO MONTH.

If both arguments are not equal to zero they should have the same sign.

Parameters:
years - years, |years|<1018
months - months, |months|<12
Returns:
INTERVAL YEAR TO MONTH
Interval(IntervalQualifier qualifier, boolean negative, long leading, long remaining)
Creates a new interval.
Interval(IntervalQualifier qualifier, boolean negative, long leading, long remaining)
Creates a new interval. Do not use this constructor, use static methods instead.
Parameters:
qualifier - qualifier
negative - whether interval is negative
leading - value of leading field
remaining - combined value of all remaining fields
boolean equals(Object obj)
boolean equals(Object obj)
long getDays()
Returns days value, if any.
long getDays()
Returns days value, if any.
Returns:
days, or 0
long getHours()
Returns hours value, if any.
long getHours()
Returns hours value, if any.
Returns:
hours, or 0
long getLeading()
Returns value of leading field of this interval.
long getLeading()
Returns value of leading field of this interval. For {@code SECOND} intervals returns integer part of seconds.
Returns:
value of leading field
long getMinutes()
Returns minutes value, if any.
long getMinutes()
Returns minutes value, if any.
Returns:
minutes, or 0
long getMonths()
Returns months value, if any.
long getMonths()
Returns months value, if any.
Returns:
months, or 0
long getNanosOfSecond()
Returns value of fractional part of seconds (in nanoseconds), if any.
long getNanosOfSecond()
Returns value of fractional part of seconds (in nanoseconds), if any.
Returns:
nanoseconds, or 0
IntervalQualifier getQualifier()
Returns qualifier of this interval.
IntervalQualifier getQualifier()
Returns qualifier of this interval.
Returns:
qualifier
long getRemaining()
Returns combined value of remaining fields of this interval.
long getRemaining()
Returns combined value of remaining fields of this interval. For {@code SECOND} intervals returns nanoseconds.
Returns:
combined value of remaining fields
long getSeconds()
Returns value of integer part of seconds, if any.
long getSeconds()
Returns value of integer part of seconds, if any.
Returns:
seconds, or 0
long getSecondsAndNanos()
Returns seconds value measured in nanoseconds, if any.
long getSecondsAndNanos()
Returns seconds value measured in nanoseconds, if any.

This method returns a long value that cannot fit all possible values of INTERVAL SECOND. For a very large intervals of this type use {@link #getSeconds()} and {@link #getNanosOfSecond()} instead. This method can be safely used for intervals of other day-time types.

Returns:
nanoseconds (including seconds), or 0
long getYears()
Returns years value, if any.
long getYears()
Returns years value, if any.
Returns:
years, or 0
int hashCode()
int hashCode()
boolean isNegative()
Returns where the interval is negative.
boolean isNegative()
Returns where the interval is negative.
Returns:
where the interval is negative
String toString()
String toString()