Package com.google.cloud.spanner
Class Interval
java.lang.Object
com.google.cloud.spanner.Interval
- All Implemented Interfaces:
Serializable
Represents the time duration as a combination of months, days and nanoseconds. Nanoseconds are
broken into two components microseconds and nanoFractions, where nanoFractions can range from
[-999, 999]. Internally, Spanner supports Interval value with the following range of individual
fields: months: [-120000, 120000] days: [-3660000, 3660000] nanoseconds: [-316224000000000000000,
316224000000000000000]. Interval value created outside the specified domain will return error
when sent to Spanner backend.
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic Interval.Builderbuilder()booleanstatic IntervalfromMonthsDaysNanos(int months, int days, BigInteger nanos) Creates an interval with specified number of months, days and nanoseconds.intgetDays()Returns the days component of the interval.intReturns the months component of the interval.getNanos()Returns the nanoseconds component of the interval.inthashCode()static IntervalofDays(int days) Creates an interval with specified number of days.static IntervalofMicros(long micros) Creates an interval with specified number of microseconds.static IntervalofMillis(long millis) Creates an interval with specified number of milliseconds.static IntervalofMonths(int months) Creates an interval with specified number of months.static IntervalofNanos(BigInteger nanos) Creates an interval with specified number of nanoseconds.static IntervalofSeconds(long seconds) Creates an interval with specified number of seconds.static IntervalparseFromString(String interval) Converts Interval to ISO8601 duration format string.toString()
-
Method Details
-
getMonths
public int getMonths()Returns the months component of the interval. -
getDays
public int getDays()Returns the days component of the interval. -
getNanos
Returns the nanoseconds component of the interval. -
builder
-
ofMonths
Creates an interval with specified number of months. -
ofDays
Creates an interval with specified number of days. -
ofSeconds
Creates an interval with specified number of seconds. -
ofMillis
Creates an interval with specified number of milliseconds. -
ofMicros
Creates an interval with specified number of microseconds. -
ofNanos
Creates an interval with specified number of nanoseconds. -
fromMonthsDaysNanos
Creates an interval with specified number of months, days and nanoseconds. -
parseFromString
-
toISO8601
Converts Interval to ISO8601 duration format string. -
toString
-
equals
-
hashCode
public int hashCode()
-