public class TimestampWithTimeZoneString extends java.lang.Object implements java.lang.Comparable<TimestampWithTimeZoneString>
Immutable, internally represented as a string (in ISO format), and can support unlimited precision (milliseconds, nanoseconds).
Modifier and Type | Field and Description |
---|---|
(package private) TimestampString |
localDateTime |
(package private) java.util.TimeZone |
timeZone |
(package private) java.lang.String |
v |
Constructor and Description |
---|
TimestampWithTimeZoneString(int year,
int month,
int day,
int h,
int m,
int s,
java.lang.String timeZone)
Creates a TimestampWithTimeZoneString for year, month, day, hour, minute, second,
millisecond values in the given time-zone.
|
TimestampWithTimeZoneString(java.lang.String v)
Creates a TimestampWithTimeZoneString.
|
TimestampWithTimeZoneString(TimestampString localDateTime,
java.util.TimeZone timeZone)
Creates a TimestampWithTimeZoneString.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(TimestampWithTimeZoneString o) |
boolean |
equals(java.lang.Object o) |
static TimestampWithTimeZoneString |
fromMillisSinceEpoch(long millis)
Creates a TimestampWithTimeZoneString that is a given number of milliseconds since
the epoch UTC.
|
DateString |
getLocalDateString() |
TimestampString |
getLocalTimestampString() |
TimeString |
getLocalTimeString() |
int |
hashCode() |
TimestampWithTimeZoneString |
round(int precision) |
java.lang.String |
toString() |
java.lang.String |
toString(int precision)
Converts this TimestampWithTimeZoneString to a string, truncated or padded with
zeroes to a given precision.
|
TimestampWithTimeZoneString |
withFraction(java.lang.String fraction)
Sets the fraction field of a
TimestampString . |
TimestampWithTimeZoneString |
withMillis(int millis)
Sets the fraction field of a
TimestampWithTimeZoneString to a given number
of milliseconds. |
TimestampWithTimeZoneString |
withNanos(int nanos)
Sets the fraction field of a
TimestampWithTimeZoneString to a given number
of nanoseconds. |
TimestampWithTimeZoneString |
withTimeZone(java.util.TimeZone timeZone) |
final TimestampString localDateTime
final java.util.TimeZone timeZone
final java.lang.String v
public TimestampWithTimeZoneString(TimestampString localDateTime, java.util.TimeZone timeZone)
public TimestampWithTimeZoneString(java.lang.String v)
public TimestampWithTimeZoneString(int year, int month, int day, int h, int m, int s, java.lang.String timeZone)
public TimestampWithTimeZoneString withMillis(int millis)
TimestampWithTimeZoneString
to a given number
of milliseconds. Nukes the value set via withNanos(int)
.
For example,
new TimestampWithTimeZoneString(1970, 1, 1, 2, 3, 4, "GMT").withMillis(56)
yields TIMESTAMP WITH LOCAL TIME ZONE '1970-01-01 02:03:04.056 GMT'
.
public TimestampWithTimeZoneString withNanos(int nanos)
TimestampWithTimeZoneString
to a given number
of nanoseconds. Nukes the value set via withMillis(int)
.
For example,
new TimestampWithTimeZoneString(1970, 1, 1, 2, 3, 4, "GMT").withNanos(56789)
yields TIMESTAMP WITH LOCAL TIME ZONE '1970-01-01 02:03:04.000056789 GMT'
.
public TimestampWithTimeZoneString withFraction(java.lang.String fraction)
TimestampString
.
The precision is determined by the number of leading zeros.
Trailing zeros are stripped.
For example, new TimestampWithTimeZoneString(1970, 1, 1, 2, 3, 4, "GMT").withFraction("00506000")
yields TIMESTAMP WITH LOCAL TIME ZONE '1970-01-01 02:03:04.00506 GMT'
.
public TimestampWithTimeZoneString withTimeZone(java.util.TimeZone timeZone)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(TimestampWithTimeZoneString o)
compareTo
in interface java.lang.Comparable<TimestampWithTimeZoneString>
public TimestampWithTimeZoneString round(int precision)
public static TimestampWithTimeZoneString fromMillisSinceEpoch(long millis)
public java.lang.String toString(int precision)
public DateString getLocalDateString()
public TimeString getLocalTimeString()
public TimestampString getLocalTimestampString()
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.