public static String formatDate(final Instant instant, final DateTimeFormatter dateTimeFormatter) {
        Args.notNull(instant, "Instant");
        Args.notNull(dateTimeFormatter, "DateTimeFormatter");
        return dateTimeFormatter.format(instant.atZone(GMT_ID));
    }
Formats the given date according to the specified pattern.

@param instant Instant to format.
@param dateTimeFormatter The pattern to use for formatting the instant.
@return A formatted instant string.

@throws IllegalArgumentException If the given date pattern is invalid.

@since 5.2
httpclient5/src/main/java/org/apache/hc/client5/http/utils/DateUtils.java