public class TimeWithTimeZoneString extends Object implements Comparable<TimeWithTimeZoneString>
Immutable, internally represented as a string (in ISO format), and can support unlimited precision (milliseconds, nanoseconds).
| Constructor and Description |
|---|
TimeWithTimeZoneString(int h,
int m,
int s,
String timeZone)
Creates a TimeWithTimeZoneString for hour, minute, second and millisecond values
in the given time-zone.
|
TimeWithTimeZoneString(String v)
Creates a TimeWithTimeZoneString.
|
TimeWithTimeZoneString(TimeString localTime,
TimeZone timeZone)
Creates a TimeWithTimeZoneString.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(TimeWithTimeZoneString o) |
boolean |
equals(@Nullable Object o) |
static TimeWithTimeZoneString |
fromMillisOfDay(int i) |
TimeString |
getLocalTimeString() |
int |
hashCode() |
TimeWithTimeZoneString |
round(int precision) |
String |
toString() |
String |
toString(int precision)
Converts this TimeWithTimeZoneString to a string, truncated or padded with
zeros to a given precision.
|
TimeWithTimeZoneString |
withFraction(String fraction)
Sets the fraction field of a
TimeWithTimeZoneString. |
TimeWithTimeZoneString |
withMillis(int millis)
Sets the fraction field of a
TimeWithTimeZoneString to a given number
of milliseconds. |
TimeWithTimeZoneString |
withNanos(int nanos)
Sets the fraction field of a
TimeString to a given number
of nanoseconds. |
TimeWithTimeZoneString |
withTimeZone(TimeZone timeZone) |
public TimeWithTimeZoneString(TimeString localTime, TimeZone timeZone)
public TimeWithTimeZoneString(String v)
public TimeWithTimeZoneString(int h,
int m,
int s,
String timeZone)
public TimeWithTimeZoneString withMillis(int millis)
TimeWithTimeZoneString to a given number
of milliseconds. Nukes the value set via withNanos(int).
For example,
new TimeWithTimeZoneString(1970, 1, 1, 2, 3, 4, "UTC").withMillis(56)
yields TIME WITH LOCAL TIME ZONE '1970-01-01 02:03:04.056 UTC'.
public TimeWithTimeZoneString withNanos(int nanos)
TimeString to a given number
of nanoseconds. Nukes the value set via withMillis(int).
For example,
new TimeWithTimeZoneString(1970, 1, 1, 2, 3, 4, "UTC").withNanos(56789)
yields TIME WITH LOCAL TIME ZONE '1970-01-01 02:03:04.000056789 UTC'.
public TimeWithTimeZoneString withFraction(String fraction)
TimeWithTimeZoneString.
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")
yields TIME WITH LOCAL TIME ZONE '1970-01-01 02:03:04.00506 UTC'.
public TimeWithTimeZoneString withTimeZone(TimeZone timeZone)
public int compareTo(TimeWithTimeZoneString o)
compareTo in interface Comparable<TimeWithTimeZoneString>public TimeWithTimeZoneString round(int precision)
public static TimeWithTimeZoneString fromMillisOfDay(int i)
public String toString(int precision)
public TimeString getLocalTimeString()
Copyright © 2012-2022 Apache Software Foundation. All Rights Reserved.