Class DateUtils

java.lang.Object
software.amazon.awssdk.utils.DateUtils

@ThreadSafe public final class DateUtils extends Object
Utilities for parsing and formatting dates.
  • Method Details

    • parseIso8601Date

      public 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.
      Parameters:
      dateString - The date string to parse.
      Returns:
      The parsed Instant object.
    • formatIso8601Date

      public static String formatIso8601Date(Instant date)
      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

      public static Instant parseRfc822Date(String dateString)
      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

      public static String formatRfc822Date(Instant instant)
      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

      public static Instant parseRfc1123Date(String dateString)
      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

      public static String formatRfc1123Date(Instant instant)
      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

      public static Instant parseUnixTimestampInstant(String dateString) throws NumberFormatException
      Parses the given string containing a Unix timestamp with millisecond decimal precision into an Instant object.
      Throws:
      NumberFormatException
    • parseUnixTimestampMillisInstant

      public static Instant parseUnixTimestampMillisInstant(String dateString) throws NumberFormatException
      Parses the given string containing a Unix timestamp in epoch millis into a Instant object.
      Throws:
      NumberFormatException
    • formatUnixTimestampInstant

      public static String formatUnixTimestampInstant(Instant instant)
      Formats the give Instant object into an Unix timestamp with millisecond decimal precision.