Instants¶
Methods¶
Converts an Instant to milliseconds bound to a |
|
Returns the given non-null instant, or |
|
Returns the given non-null instant, or |
|
Converts an Instant to milliseconds since that Instant bound to a |
- public static long toEpochMillis(Instant instant)[source]¶
Converts an Instant to milliseconds bound to a
longwithout throwingArithmeticException.If the duration milliseconds are greater than
Long#MAX_VALUE, then returnLong#MAX_VALUE.If the duration milliseconds are lesser than
Long#MIN_VALUE, then returnLong#MIN_VALUE.If the instant is null, treat it as
Instant#EPOCH.
- Parameters:
instant – The instant to convert, not null.
- Returns:
long The given Instant in milliseconds.
- See also:
- public static Instant toInstant(Instant instant)[source]¶
Returns the given non-null instant, or
Instant#EPOCHif null.- Parameters:
instant – The instant to test, may be null.
- Returns:
The given non-null instant, or
Instant#EPOCHif null.
- public static Instant toInstant(Instant instant, Instant defaultInstant)[source]¶
Returns the given non-null instant, or
defaultInstantif instant is null.- Parameters:
instant – The instant to test, may be null.
defaultInstant – The default instant to use if the given instant is null, may be null.
- Returns:
The given non-null instant, or
defaultInstantif null.
- public static long toMillisSince(Instant instant)[source]¶
Converts an Instant to milliseconds since that Instant bound to a
longwithout throwingArithmeticException.If the duration milliseconds are greater than
Long#MAX_VALUE, then returnLong#MAX_VALUE.If the duration milliseconds are lesser than
Long#MIN_VALUE, then returnLong#MIN_VALUE.If the instant is null, treat it as
Instant#EPOCH.
- Parameters:
instant – The instant to convert, not null.
- Returns:
long The duration in milliseconds since the given Instant.