Package software.amazon.awssdk.utils
Class DateUtils
java.lang.Object
software.amazon.awssdk.utils.DateUtils
Utilities for parsing and formatting dates.
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
formatRfc822Date
(Instant instant) Formats the specified date as an RFC 822 string.static String
formatUnixTimestampInstant
(Instant instant) Formats the giveInstant
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 theInstant
object.static Instant
parseRfc1123Date
(String dateString) Parses the specified date string as an RFC 1123 date and returns the Date object.static Instant
parseRfc822Date
(String dateString) Parses the specified date string as an RFC 822 date and returns the Date object.static Instant
parseUnixTimestampInstant
(String dateString) Parses the given string containing a Unix timestamp with millisecond decimal precision into anInstant
object.static Instant
parseUnixTimestampMillisInstant
(String dateString) Parses the given string containing a Unix timestamp in epoch millis into aInstant
object.
-
Method Details
-
parseIso8601Date
Parses the specified date string as an ISO 8601 date (yyyy-MM-dd'T'HH:mm:ss.SSSZZ) and returns theInstant
object.- Parameters:
dateString
- The date string to parse.- Returns:
- The parsed Instant object.
-
formatIso8601Date
Formats the specified date as an ISO 8601 string.- Parameters:
date
- the date to format- Returns:
- the ISO-8601 string representing the specified date
-
parseRfc822Date
Parses the specified date string as an RFC 822 date and returns the Date object.- Parameters:
dateString
- The date string to parse.- Returns:
- The parsed Date object.
-
formatRfc822Date
Formats the specified date as an RFC 822 string.- Parameters:
instant
- The instant to format.- Returns:
- The RFC 822 string representing the specified date.
-
parseRfc1123Date
Parses the specified date string as an RFC 1123 date and returns the Date object.- Parameters:
dateString
- The date string to parse.- Returns:
- The parsed Date object.
-
formatRfc1123Date
Formats the specified date as an RFC 1123 string.- Parameters:
instant
- The instant to format.- Returns:
- The RFC 1123 string representing the specified date.
-
numberOfDaysSinceEpoch
public static long numberOfDaysSinceEpoch(long milliSinceEpoch) Returns the number of days since epoch with respect to the given number of milliseconds since epoch. -
parseUnixTimestampInstant
Parses the given string containing a Unix timestamp with millisecond decimal precision into anInstant
object.- Throws:
NumberFormatException
-
parseUnixTimestampMillisInstant
public static Instant parseUnixTimestampMillisInstant(String dateString) throws NumberFormatException Parses the given string containing a Unix timestamp in epoch millis into aInstant
object.- Throws:
NumberFormatException
-
formatUnixTimestampInstant
Formats the giveInstant
object into an Unix timestamp with millisecond decimal precision.
-