public final class YearToMonth extends java.lang.Number implements Interval, java.lang.Comparable<YearToMonth>
INTERVAL YEAR TO MONTH
data type.
YearToMonth is a Number whose Number.intValue()
represents the number of months of the interval.
Note: only a few databases actually support this data type on its own. You
can still use it for date time arithmetic in other databases, though, through
Field.add(Field) and Field.sub(Field) Databases that have
been observed to natively support INTERVAL data types are:
These dialects have been observed to partially support INTERVAL
data types in date time arithmetic functions, such as
TIMESTAMPADD, and TIMESTAMPDIFF:
Interval,
Serialized Form| Constructor and Description |
|---|
YearToMonth(int years)
Create a new year-month interval.
|
YearToMonth(int years,
int months)
Create a new year-month interval.
|
| Modifier and Type | Method and Description |
|---|---|
YearToMonth |
abs()
Get the absolute value of the interval (set its sign to positive)
|
int |
compareTo(YearToMonth that) |
double |
doubleValue() |
boolean |
equals(java.lang.Object obj) |
float |
floatValue() |
int |
getMonths() |
int |
getSign()
The sign of the interval
|
int |
getYears() |
int |
hashCode() |
int |
intValue() |
long |
longValue() |
YearToMonth |
neg()
Negate the interval (change its sign)
|
java.lang.String |
toString() |
static YearToMonth |
valueOf(java.lang.String string)
Parse a string representation of a
INTERVAL YEAR TO MONTH |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitbyteValue, shortValuepublic YearToMonth(int years)
public YearToMonth(int years,
int months)
public static YearToMonth valueOf(java.lang.String string)
INTERVAL YEAR TO MONTHstring - A string representation of the form
[+|-][years]-[months]YEAR TO MONTH object, or
null if the string could not be parsed.public final YearToMonth neg()
Intervalpublic final YearToMonth abs()
Intervalpublic final int getYears()
public final int getMonths()
public final int getSign()
Intervalpublic final int intValue()
public final long longValue()
public final float floatValue()
floatValue in interface IntervalfloatValue in class java.lang.NumberNumber.floatValue()public final double doubleValue()
doubleValue in interface IntervaldoubleValue in class java.lang.NumberNumber.doubleValue()public final int compareTo(YearToMonth that)
compareTo in interface java.lang.Comparable<YearToMonth>public final int hashCode()
hashCode in class java.lang.Objectpublic final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic final java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2014. All Rights Reserved.