/** * Parse the string to date * * @param date to parse. Accepted formats are yyyyMMddHHmm and yyyyMMdd * @return the parsed date or null if input could not be parsed */ public static Date getDate(String date) { if (StringUtils.isEmpty(date)) return null; return DateUtils.parseDate(date, patterns); }
/** * Format the given date in given format * * @param date to format * @param pattern e.g. yyyyMMddHHmm * @return formatted date */ public static String formatDate(Date date, String pattern) { return DateUtils.formatDate(date, pattern); }
/** * Parses a date value. The formats used for parsing the date value are retrieved from * the default http params. * * @param dateValue the date value to parse * * @return the parsed date or null if input could not be parsed */ public static Date parseDate(final String dateValue) { return parseDate(dateValue, null, null); }
/** * Format the given date in format yyyyMMdd * * @param date to format * @return date formatted in yyyyMMdd */ public static String formatyyyyMMdd(Date date) { if (date == null) return null; return DateUtils.formatDate(date, yyyyMMdd); }
/** * Parses a date value. The formats used for parsing the date value are retrieved from * the default http params. * * @param dateValue the date value to parse * * @return the parsed date or null if input could not be parsed */ public static Date parseDate(final String dateValue) { return parseDate(dateValue, null, null); }
/** * Format the given date in format yyyyMMddHHmm * * @param date to format * @return date formatted in yyyyMMddHHmm */ public static String formatyyyyMMddHHmm(Date date) { if (date == null) return null; return DateUtils.formatDate(date, yyyyMMddHHmm); }
/** * Parses the date value using the given date formats. * * @param dateValue the date value to parse * @param dateFormats the date formats to use * * @return the parsed date or null if input could not be parsed */ public static Date parseDate(final String dateValue, final String[] dateFormats) { return parseDate(dateValue, dateFormats, null); }
/** * Formats the given date according to the RFC 1123 pattern. * * @param date The date to format. * @return An RFC 1123 formatted date string. * * @see #PATTERN_RFC1123 */ public static String formatDate(final Date date) { return formatDate(date, PATTERN_RFC1123); }
/** * Parses a date value. The formats used for parsing the date value are retrieved from * the default http params. * * @param dateValue the date value to parse * * @return the parsed date or null if input could not be parsed */ public static Date parseDate(final String dateValue) { return parseDate(dateValue, null, null); }
/** * Formats the given date according to the RFC 1123 pattern. * * @param date The date to format. * @return An RFC 1123 formatted date string. * * @see #PATTERN_RFC1123 */ public static String formatDate(final Date date) { return formatDate(date, PATTERN_RFC1123); }
/** * Parses a date value. The formats used for parsing the date value are retrieved from * the default http params. * * @param dateValue the date value to parse * * @return the parsed date or null if input could not be parsed */ public static Date parseDate(final String dateValue) { return parseDate(dateValue, null, null); }
/** * Formats the given date according to the RFC 1123 pattern. * * @param date The date to format. * @return An RFC 1123 formatted date string. * * @see #PATTERN_RFC1123 */ public static String formatDate(final Date date) { return org.apache.http.client.utils.DateUtils.formatDate(date); }
/** * Parses a date value. The formats used for parsing the date value are retrieved from * the default http params. * * @param dateValue the date value to parse * * @return the parsed date or null if input could not be parsed */ public static Date parseDate(final String dateValue) { return parseDate(dateValue, null, null); }
/** * Formats the given date according to the RFC 1123 pattern. * * @param date The date to format. * @return An RFC 1123 formatted date string. * * @see #PATTERN_RFC1123 */ public static String formatDate(final Date date) { return formatDate(date, PATTERN_RFC1123); }
/** * Parses the date value using the given date formats. * * @param dateValue the date value to parse * @param dateFormats the date formats to use * * @return the parsed date or null if input could not be parsed */ public static Date parseDate(final String dateValue, final String[] dateFormats) { return parseDate(dateValue, dateFormats, null); }
/** * Formats the given date according to the RFC 1123 pattern. * * @param date * The date to format. * @return An RFC 1123 formatted date string. * */ public static String formatDate(Date date) { return org.apache.http.client.utils.DateUtils.formatDate(date); }
/** * Parses the date value using the given date formats. * * @param dateValue the date value to parse * @param dateFormats the date formats to use * * @return the parsed date or null if input could not be parsed */ public static Date parseDate(final String dateValue, final String[] dateFormats) { return parseDate(dateValue, dateFormats, null); }
/** * Formats the given date according to the RFC 1123 pattern. * * @param date The date to format. * @return An RFC 1123 formatted date string. * * @see #PATTERN_RFC1123 */ public static String formatDate(final Date date) { return formatDate(date, PATTERN_RFC1123); }
/** * Parses the specified date string, assuming that it is formatted according to RFC 1123, RFC 1036 or as an ANSI * C HTTP date header. This method returns {@code null} if the specified string is {@code null} or unparseable. * * @param s the string to parse as a date * @return the date version of the specified string, or {@code null} */ public static Date parseHttpDate(final String s) { if (s == null) { return null; } return DateUtils.parseDate(s); }
/** * Creates a date request property in RFC2616 format. * * @param name The header name. * @param value The header value. */ public DateHeader(String name, Date value) { super(name, DateUtils.formatDate(value)); } }