Class IntervalDayToSecond


  • public final class IntervalDayToSecond
    extends AbstractInterval
    This class implements the Exasol-proprietary data type value INTERVAL 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.

    • 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 an IntervalDayToSecond 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 an IntervalDayToSecond from a string

        The 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