Package org.apache.calcite.util
Class TimeWithTimeZoneString
java.lang.Object
org.apache.calcite.util.TimeWithTimeZoneString
- All Implemented Interfaces:
Comparable<TimeWithTimeZoneString>
Time with time-zone literal.
Immutable, internally represented as a string (in ISO format), and can support unlimited precision (milliseconds, nanoseconds).
-
Constructor Summary
ConstructorDescriptionTimeWithTimeZoneString
(int h, int m, int s, String timeZone) Creates a TimeWithTimeZoneString for hour, minute, second and millisecond values in the given time-zone.Creates a TimeWithTimeZoneString.TimeWithTimeZoneString
(TimeString localTime, TimeZone timeZone) Creates a TimeWithTimeZoneString. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
static TimeWithTimeZoneString
fromCalendarFields
(Calendar calendar) Creates a TimeWithTimeZoneString from a Calendar.static TimeWithTimeZoneString
fromMillisOfDay
(int i) int
hashCode()
round
(int precision) toString()
toString
(int precision) Converts this TimeWithTimeZoneString to a string, truncated or padded with zeros to a given precision.withFraction
(String fraction) Sets the fraction field of aTimeWithTimeZoneString
.withMillis
(int millis) Sets the fraction field of aTimeWithTimeZoneString
to a given number of milliseconds.withNanos
(int nanos) Sets the fraction field of aTimeString
to a given number of nanoseconds.withTimeZone
(TimeZone timeZone)
-
Constructor Details
-
TimeWithTimeZoneString
Creates a TimeWithTimeZoneString. -
TimeWithTimeZoneString
Creates a TimeWithTimeZoneString. -
TimeWithTimeZoneString
Creates a TimeWithTimeZoneString for hour, minute, second and millisecond values in the given time-zone.
-
-
Method Details
-
withMillis
Sets the fraction field of aTimeWithTimeZoneString
to a given number of milliseconds. Nukes the value set viawithNanos(int)
.For example,
new TimeWithTimeZoneString(1970, 1, 1, 2, 3, 4, "UTC").withMillis(56)
yieldsTIME WITH LOCAL TIME ZONE '1970-01-01 02:03:04.056 UTC'
. -
fromCalendarFields
Creates a TimeWithTimeZoneString from a Calendar. -
withNanos
Sets the fraction field of aTimeString
to a given number of nanoseconds. Nukes the value set viawithMillis(int)
.For example,
new TimeWithTimeZoneString(1970, 1, 1, 2, 3, 4, "UTC").withNanos(56789)
yieldsTIME WITH LOCAL TIME ZONE '1970-01-01 02:03:04.000056789 UTC'
. -
withFraction
Sets the fraction field of aTimeWithTimeZoneString
. The precision is determined by the number of leading zeros. Trailing zeros are stripped.For example,
new TimeWithTimeZoneString(1970, 1, 1, 2, 3, 4, "UTC").withFraction("00506000")
yieldsTIME WITH LOCAL TIME ZONE '1970-01-01 02:03:04.00506 UTC'
. -
withTimeZone
-
toString
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable<TimeWithTimeZoneString>
-
round
-
fromMillisOfDay
-
toString
Converts this TimeWithTimeZoneString to a string, truncated or padded with zeros to a given precision. -
getLocalTimeString
-