protobuf/timestamp.proto. All operations throw an
IllegalArgumentException if the input(s) are not valid.
| Modifier and Type | Field and Description |
|---|---|
| private static final Comparator | |
| public static final Timestamp | |
| public static final Timestamp | |
| pack-priv static final long | |
| pack-priv static final long | |
| public static final Timestamp | |
| pack-priv static final long | |
| pack-priv static final long | |
| pack-priv static final long | |
| pack-priv static final long | |
| pack-priv static final long | |
| private static final ThreadLocal |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Timestamp | |
| public static Duration | |
| public static Timestamp | checkValid(Timestamp timestamp)
Throws an |
| public static Timestamp | Returns: A valid, builtTimestamp.Builds the given builder and throws an |
| public static Comparator | |
| public static int | |
| private static SimpleDateFormat | |
| pack-priv static String | |
| public static Timestamp | fromMicros(long microseconds)
Create a Timestamp from the number of microseconds elapsed from the epoch. |
| public static Timestamp | fromMillis(long milliseconds)
Create a Timestamp from the number of milliseconds elapsed from the epoch. |
| public static Timestamp | fromNanos(long nanoseconds)
Create a Timestamp from the number of nanoseconds elapsed from the epoch. |
| public static Timestamp | |
| public static boolean | |
| public static boolean | |
| pack-priv static Timestamp | |
| public static Timestamp | |
| pack-priv static int | |
| private static long | |
| public static Timestamp | |
| public static long | |
| public static long | |
| public static long | |
| public static long | |
| public static String |
| COMPARATOR | back to summary |
|---|---|
| private static final Comparator<Timestamp> COMPARATOR | |
| EPOCH | back to summary |
|---|---|
| public static final Timestamp EPOCH A constant holding the | |
| MAX_VALUE | back to summary |
|---|---|
| public static final Timestamp MAX_VALUE A constant holding the maximum valid | |
| MICROS_PER_SECOND | back to summary |
|---|---|
| pack-priv static final long MICROS_PER_SECOND | |
| MILLIS_PER_SECOND | back to summary |
|---|---|
| pack-priv static final long MILLIS_PER_SECOND | |
| MIN_VALUE | back to summary |
|---|---|
| public static final Timestamp MIN_VALUE A constant holding the minimum valid | |
| NANOS_PER_MICROSECOND | back to summary |
|---|---|
| pack-priv static final long NANOS_PER_MICROSECOND | |
| NANOS_PER_MILLISECOND | back to summary |
|---|---|
| pack-priv static final long NANOS_PER_MILLISECOND | |
| NANOS_PER_SECOND | back to summary |
|---|---|
| pack-priv static final long NANOS_PER_SECOND | |
| TIMESTAMP_SECONDS_MAX | back to summary |
|---|---|
| pack-priv static final long TIMESTAMP_SECONDS_MAX | |
| TIMESTAMP_SECONDS_MIN | back to summary |
|---|---|
| pack-priv static final long TIMESTAMP_SECONDS_MIN | |
| timestampFormat | back to summary |
|---|---|
| private static final ThreadLocal<SimpleDateFormat> timestampFormat | |
| Timestamps | back to summary |
|---|---|
| private Timestamps() | |
| add | back to summary |
|---|---|
| public static Timestamp add(Timestamp start, Duration length) Add a duration to a timestamp. | |
| between | back to summary |
|---|---|
| public static Duration between(Timestamp from, Timestamp to) Calculate the difference between two timestamps. | |
| checkValid | back to summary |
|---|---|
| public static Timestamp checkValid(Timestamp timestamp) Throws an
| |
| checkValid | back to summary |
|---|---|
| public static Timestamp checkValid(Timestamp. Builds the given builder and throws an | |
| comparator | back to summary |
|---|---|
| public static Comparator Returns a | |
| compare | back to summary |
|---|---|
| public static int compare(Timestamp x, Timestamp y) Compares two timestamps. The value returned is identical to what would be returned by:
| |
| createTimestampFormat | back to summary |
|---|---|
| private static SimpleDateFormat createTimestampFormat() | |
| formatNanos | back to summary |
|---|---|
| pack-priv static String formatNanos(int nanos) Format the nano part of a timestamp or a duration. | |
| fromMicros | back to summary |
|---|---|
| public static Timestamp fromMicros(long microseconds) Create a Timestamp from the number of microseconds elapsed from the epoch.
| |
| fromMillis | back to summary |
|---|---|
| public static Timestamp fromMillis(long milliseconds) Create a Timestamp from the number of milliseconds elapsed from the epoch.
| |
| fromNanos | back to summary |
|---|---|
| public static Timestamp fromNanos(long nanoseconds) Create a Timestamp from the number of nanoseconds elapsed from the epoch.
| |
| fromSeconds | back to summary |
|---|---|
| public static Timestamp fromSeconds(long seconds) Create a Timestamp from the number of seconds elapsed from the epoch.
| |
| isValid | back to summary |
|---|---|
| public static boolean isValid(Timestamp timestamp) Returns true if the given Note Negative second values with fractional seconds must still have non-negative nanos values that count forward in time. | |
| isValid | back to summary |
|---|---|
| public static boolean isValid(long seconds, int nanos) Returns true if the given number of seconds and nanos is a valid Note Negative second values with fractional seconds must still have non-negative nanos values that count forward in time.
| |
| normalizedTimestamp | back to summary |
|---|---|
| pack-priv static Timestamp normalizedTimestamp(long seconds, int nanos) | |
| parse | back to summary |
|---|---|
| public static Timestamp parse(String value) throws ParseException Parse from RFC 3339 date string to Timestamp. This method accepts all outputs of Example of accepted format: "1972-01-01T10:00:20.021-05:00"
| |
| parseNanos | back to summary |
|---|---|
| pack-priv static int parseNanos(String value) throws ParseException | |
| parseTimezoneOffset | back to summary |
|---|---|
| private static long parseTimezoneOffset(String value) throws ParseException | |
| subtract | back to summary |
|---|---|
| public static Timestamp subtract(Timestamp start, Duration length) Subtract a duration from a timestamp. | |
| toMicros | back to summary |
|---|---|
| public static long toMicros(Timestamp timestamp) Convert a Timestamp to the number of microseconds elapsed from the epoch. The result will be rounded down to the nearest microsecond. E.g., if the timestamp represents "1969-12-31T23:59:59.999999999Z", it will be rounded to -1 microsecond.
| |
| toMillis | back to summary |
|---|---|
| public static long toMillis(Timestamp timestamp) Convert a Timestamp to the number of milliseconds elapsed from the epoch. The result will be rounded down to the nearest millisecond. E.g., if the timestamp represents "1969-12-31T23:59:59.999999999Z", it will be rounded to -1 millisecond.
| |
| toNanos | back to summary |
|---|---|
| public static long toNanos(Timestamp timestamp) Convert a Timestamp to the number of nanoseconds elapsed from the epoch.
| |
| toSeconds | back to summary |
|---|---|
| public static long toSeconds(Timestamp timestamp) Convert a Timestamp to the number of seconds elapsed from the epoch. The result will be rounded down to the nearest second. E.g., if the timestamp represents "1969-12-31T23:59:59.999999999Z", it will be rounded to -1 second.
| |
| toString | back to summary |
|---|---|
| public static String toString(Timestamp timestamp) Convert Timestamp to RFC 3339 date string format. The output will always be Z-normalized and uses 3, 6 or 9 fractional digits as required to represent the exact value. Note that Timestamp can only represent time from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. See https://www.ietf.org/rfc/rfc3339.txt Example of generated format: "1972-01-01T10:00:20.021Z"
| |