The IntervalDF methods
The following methods allow you to manipulate intervals.
(You can also use the Interval methods, described previously.)
The tasks you can perform, and the methods you can use, are as follows:
- Comparing two intervals:
boolean equals(Object other) boolean greaterThan(IntervalDF other) boolean lessThan(IntervalDF other)
- Setting a value for an interval from:
- A string:
void fromString(String other) void set(String string)
- Second and nanosecond values (large second values are converted
to minutes, hours, or days):
void set(long seconds, long nanos)
- Two time stamps:
void set(Timestamp t1, Timestamp t2)
- A string:
- Setting the qualifier from the length, start code, and end code:
void setQualifier(int length, byte startcode, byte endcode)
- Obtaining the number of nanoseconds in the interval:
long getNanoSeconds()
- Obtaining the number of seconds in the interval:
long getSeconds()
- Creating a string representation of the interval in the format
ddddd hh:mm:ss.nano
:String toString()
The fields present depend on the qualifier. Blanks replace leading zeros.