public class TimestampUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static long |
GREGORIAN_MILLISECONDS |
static long |
MILLISECONDS_PER_SECOND |
static long |
TIMESTAMP_RESOLUTION |
| Modifier and Type | Method and Description |
|---|---|
static long |
getCurrentTimestamp()
Get the current timestamp with milliseconds precision.
|
static Instant |
toInstant(long timestamp)
Get the instant of the given timestamp with milliseconds precision.
|
static long |
toTimestamp(Instant instant)
Get the timestamp of a given instant with milliseconds precision.
|
static long |
toTimestamp(long unixMilliseconds)
Get the timestamp of a given Unix Epoch milliseconds.
|
static long |
toUnixMilliseconds(long timestamp)
Get the Unix Epoch milliseconds of a given timestmap.
|
public static final long GREGORIAN_MILLISECONDS
public static final long MILLISECONDS_PER_SECOND
public static final long TIMESTAMP_RESOLUTION
public static long getCurrentTimestamp()
public static long toTimestamp(long unixMilliseconds)
unixMilliseconds - the Unix Epoch millisecondspublic static long toUnixMilliseconds(long timestamp)
timestamp - a timestamppublic static long toTimestamp(Instant instant)
instant - an instantpublic static Instant toInstant(long timestamp)
timestamp - a timestampCopyright © 2020. All rights reserved.