public final class DayToSecond extends Number implements Interval, Comparable<DayToSecond>
INTERVAL DAY TO SECOND
data type.
DayToSecond
is a Number
whose Number.intValue()
represents the (truncated) number of milliseconds of the interval,
Number.doubleValue()
represents the approximative number of
milliseconds (including hours, minutes, seconds, nanoseconds) 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 FormConstructor and Description |
---|
DayToSecond(int days)
Create a new day-hour interval.
|
DayToSecond(int days,
int hours)
Create a new day-hour interval.
|
DayToSecond(int days,
int hours,
int minutes)
Create a new day-hour interval.
|
DayToSecond(int days,
int hours,
int minutes,
int seconds)
Create a new day-hour interval.
|
DayToSecond(int days,
int hours,
int minutes,
int seconds,
int nano)
Create a new day-hour interval.
|
Modifier and Type | Method and Description |
---|---|
DayToSecond |
abs()
Get the absolute value of the interval (set its sign to positive)
|
int |
compareTo(DayToSecond that) |
double |
doubleValue() |
boolean |
equals(Object obj) |
float |
floatValue() |
int |
getDays()
Get the day-part of this interval
|
int |
getHours()
Get the hour-part of this interval
|
int |
getMicro()
Get the (truncated) micro-part of this interval
|
int |
getMilli()
Get the (truncated) milli-part of this interval
|
int |
getMinutes()
Get the minute-part of this interval
|
int |
getNano()
Get the nano-part of this interval
|
int |
getSeconds()
Get the second-part of this interval
|
int |
getSign()
The sign of the interval
|
double |
getTotalDays()
Get the whole interval in days
|
double |
getTotalHours()
Get the whole interval in hours
|
double |
getTotalMicro()
Get the whole interval in micro-seconds
|
double |
getTotalMilli()
Get the whole interval in milli-seconds
|
double |
getTotalMinutes()
Get the whole interval in minutes
|
double |
getTotalNano()
Get the whole interval in nano-seconds
|
double |
getTotalSeconds()
Get the whole interval in seconds
|
int |
hashCode() |
int |
intValue() |
long |
longValue() |
DayToSecond |
neg()
Negate the interval (change its sign)
|
String |
toString() |
static DayToSecond |
valueOf(double milli)
Load a
Double representation of a
INTERVAL DAY TO SECOND by assuming standard 24 hour days and
60 second minutes. |
static DayToSecond |
valueOf(Duration duration)
Transform a
Duration into a DayToSecond interval by
taking its number of milliseconds. |
static DayToSecond |
valueOf(String string)
Parse a string representation of a
INTERVAL DAY TO SECOND |
byteValue, shortValue
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
byteValue, shortValue
public DayToSecond(int days)
public DayToSecond(int days, int hours)
public DayToSecond(int days, int hours, int minutes)
public DayToSecond(int days, int hours, int minutes, int seconds)
public DayToSecond(int days, int hours, int minutes, int seconds, int nano)
public static DayToSecond valueOf(String string)
INTERVAL DAY TO SECOND
string
- A string representation of the form
[+|-][days] [hours]:[minutes]:[seconds].[fractional seconds]
INTERVAL DAY TO SECOND
object, or
null
if the string could not be parsed.public static DayToSecond valueOf(double milli)
Double
representation of a
INTERVAL DAY TO SECOND
by assuming standard 24 hour days and
60 second minutes.milli
- The number of milliseconds as a fractional numberINTERVAL DAY TO SECOND
objectpublic static DayToSecond valueOf(Duration duration)
Duration
into a DayToSecond
interval by
taking its number of milliseconds.public final int intValue()
intValue
in interface Interval
intValue
in class Number
Number.intValue()
public final long longValue()
longValue
in interface Interval
longValue
in class Number
Number.longValue()
public final float floatValue()
floatValue
in interface Interval
floatValue
in class Number
Number.floatValue()
public final double doubleValue()
doubleValue
in interface Interval
doubleValue
in class Number
Number.doubleValue()
public final DayToSecond neg()
Interval
public final DayToSecond abs()
Interval
public final int getDays()
public final int getHours()
public final int getMinutes()
public final int getSeconds()
public final int getMilli()
public final int getMicro()
public final int getNano()
public final double getTotalDays()
public final double getTotalHours()
public final double getTotalMinutes()
public final double getTotalSeconds()
public final double getTotalMilli()
public final double getTotalMicro()
public final double getTotalNano()
public final int getSign()
Interval
public final int compareTo(DayToSecond that)
compareTo
in interface Comparable<DayToSecond>
Copyright © 2019. All rights reserved.