Package com.exasol.datatype.value
Class IntervalDayToSecond
- java.lang.Object
-
- com.exasol.datatype.value.AbstractInterval
-
- com.exasol.datatype.value.IntervalDayToSecond
-
public final class IntervalDayToSecond extends AbstractInterval
This class implements the Exasol-proprietary data type valueINTERVAL DAY(x) TO SECONDS(y)
. It supports conversions to and from strings and from milliseconds.In Exasol this data type represents a time difference consisting of the following components:
- days
- hours
- minutes
- seconds
- milliseconds (or fraction of seconds)
Since milliseconds are the highest resolution, each interval can also be expressed as a total number of milliseconds. This is also the recommended way to represent the interval values in other systems which do not natively support this data type.
-
-
Field Summary
-
Fields inherited from class com.exasol.datatype.value.AbstractInterval
positive, value
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IntervalDayToSecond
ofMillis(long value)
Create anIntervalDayToSecond
from a number of millisecondsstatic IntervalDayToSecond
parse(String text)
Parse anIntervalDayToSecond
from a stringlong
toMillis()
Get the interval as the total number of milliseconds between two points in time.String
toString()
-
Methods inherited from class com.exasol.datatype.value.AbstractInterval
getSign, getSignedValue, parseMatchingGroupToLong
-
-
-
-
Method Detail
-
toMillis
public long toMillis()
Get the interval as the total number of milliseconds between two points in time.- Returns:
- total number of milliseconds
-
ofMillis
public static IntervalDayToSecond ofMillis(long value)
Create anIntervalDayToSecond
from a number of milliseconds- Parameters:
value
- total length of the interval in milliseconds- Returns:
- interval with milliseconds resolution
-
parse
public static IntervalDayToSecond parse(String text)
Parse anIntervalDayToSecond
from a stringThe accepted format is:
[dddddddd ]<strong>hh:mm</strong>[:ss[.SSS]]
Where
- d
- day, 1-9 digits, optional
- h
- hours, 1-2 digits, mandatory
- m
- minutes, 1-2 digits, mandatory
- s
- seconds, 1-2 digits, optional
- S
- milliseconds, 1-3 digits, optional
- Parameters:
text
- string representing an interval- Returns:
- interval with milliseconds resolution
-
-