@Public public final class LocalZoneTimestamp extends Object implements Comparable<LocalZoneTimestamp>, Serializable
LocalZonedTimestampType.
This data structure is immutable and consists of a milliseconds and nanos-of-millisecond since
1970-01-01 00:00:00. It might be stored in a compact representation (as a long value) if
values are small enough.
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(LocalZoneTimestamp that) |
boolean |
equals(Object obj) |
static LocalZoneTimestamp |
fromEpochMillis(long milliseconds)
Creates an instance of
LocalZoneTimestamp from milliseconds. |
static LocalZoneTimestamp |
fromEpochMillis(long milliseconds,
int nanosOfMillisecond)
Creates an instance of
LocalZoneTimestamp from milliseconds and a
nanos-of-millisecond. |
static LocalZoneTimestamp |
fromInstant(java.time.Instant instant)
Creates an instance of
LocalZoneTimestamp from an instance of Instant. |
static LocalZoneTimestamp |
fromMicros(long micros)
Creates an instance of
LocalZoneTimestamp from micros. |
static LocalZoneTimestamp |
fromSQLTimestamp(Timestamp timestamp)
Creates an instance of
LocalZoneTimestamp from an instance of Timestamp. |
long |
getMillisecond()
Returns the number of milliseconds since
1970-01-01 00:00:00. |
int |
getNanoOfMillisecond()
Returns the number of nanoseconds (the nanoseconds within the milliseconds).
|
int |
hashCode() |
static boolean |
isCompact(int precision)
Returns whether the timestamp data is small enough to be stored in a long of milliseconds.
|
static LocalZoneTimestamp |
now()
Creates an instance of
LocalZoneTimestamp for now. |
java.time.Instant |
toInstant()
Converts this
LocalZoneTimestamp object to a Instant. |
long |
toMicros()
Converts this
LocalZoneTimestamp object to micros. |
LocalZoneTimestamp |
toMillisTimestamp() |
Timestamp |
toSQLTimestamp()
Converts this
LocalZoneTimestamp object to a Timestamp. |
String |
toString() |
public long getMillisecond()
1970-01-01 00:00:00.public int getNanoOfMillisecond()
The value range is from 0 to 999,999.
public Timestamp toSQLTimestamp()
LocalZoneTimestamp object to a Timestamp.public LocalZoneTimestamp toMillisTimestamp()
public java.time.Instant toInstant()
LocalZoneTimestamp object to a Instant.public long toMicros()
LocalZoneTimestamp object to micros.public int compareTo(LocalZoneTimestamp that)
compareTo in interface Comparable<LocalZoneTimestamp>public static LocalZoneTimestamp now()
LocalZoneTimestamp for now.public static LocalZoneTimestamp fromEpochMillis(long milliseconds)
LocalZoneTimestamp from milliseconds.
The nanos-of-millisecond field will be set to zero.
milliseconds - the number of milliseconds since 1970-01-01 00:00:00; a negative
number is the number of milliseconds before 1970-01-01 00:00:00public static LocalZoneTimestamp fromEpochMillis(long milliseconds, int nanosOfMillisecond)
LocalZoneTimestamp from milliseconds and a
nanos-of-millisecond.milliseconds - the number of milliseconds since 1970-01-01 00:00:00; a negative
number is the number of milliseconds before 1970-01-01 00:00:00nanosOfMillisecond - the nanoseconds within the millisecond, from 0 to 999,999public static LocalZoneTimestamp fromSQLTimestamp(Timestamp timestamp)
LocalZoneTimestamp from an instance of Timestamp.timestamp - an instance of Timestamppublic static LocalZoneTimestamp fromInstant(java.time.Instant instant)
LocalZoneTimestamp from an instance of Instant.instant - an instance of Instantpublic static LocalZoneTimestamp fromMicros(long micros)
LocalZoneTimestamp from micros.public static boolean isCompact(int precision)
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.