@ThreadSafe public final class DateUtils extends Object
Modifier and Type | Method and Description |
---|---|
static String |
formatIso8601Date(Instant date)
Formats the specified date as an ISO 8601 string.
|
static String |
formatRfc1123Date(Instant instant)
Formats the specified date as an RFC 1123 string.
|
static String |
formatUnixTimestampInstant(Instant instant)
Formats the give
Instant object into an Unix timestamp with millisecond decimal precision. |
static long |
numberOfDaysSinceEpoch(long milliSinceEpoch)
Returns the number of days since epoch with respect to the given number
of milliseconds since epoch.
|
static Instant |
parseIso8601Date(String dateString)
Parses the specified date string as an ISO 8601 date (yyyy-MM-dd'T'HH:mm:ss.SSSZZ)
and returns the
Instant object. |
static Instant |
parseRfc1123Date(String dateString)
Parses the specified date string as an RFC 1123 date and returns the Date
object.
|
static Instant |
parseUnixTimestampInstant(String dateString)
Parses the given string containing a Unix timestamp with millisecond decimal precision into an
Instant object. |
static Instant |
parseUnixTimestampMillisInstant(String dateString)
Parses the given string containing a Unix timestamp in epoch millis into a
Instant object. |
public static Instant parseIso8601Date(String dateString)
Instant
object.dateString
- The date string to parse.public static String formatIso8601Date(Instant date)
date
- the date to formatpublic static Instant parseRfc1123Date(String dateString)
dateString
- The date string to parse.public static String formatRfc1123Date(Instant instant)
instant
- The instant to format.public static long numberOfDaysSinceEpoch(long milliSinceEpoch)
public static Instant parseUnixTimestampInstant(String dateString) throws NumberFormatException
Instant
object.NumberFormatException
public static Instant parseUnixTimestampMillisInstant(String dateString) throws NumberFormatException
Instant
object.NumberFormatException
Copyright © 2020. All rights reserved.