/** * 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); }
/** * Formats the given date according to the specified pattern. The pattern * must conform to that used by the {@link SimpleDateFormat simple date * format} class. * * @param date The date to format. * @param pattern The pattern to use for formatting the date. * @return A formatted date string. * * @throws IllegalArgumentException If the given date pattern is invalid. * * @see SimpleDateFormat */ public static String formatDate(final Date date, final String pattern) { notNull(date, "Date"); notNull(pattern, "Pattern"); final SimpleDateFormat formatter = DateFormatHolder.formatFor(pattern); return formatter.format(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); }
final String[] dateFormats, final Date startDate) { notNull(dateValue, "Date value"); final String[] localDateFormats = dateFormats != null ? dateFormats : DEFAULT_PATTERNS; final Date localStartDate = startDate != null ? startDate : DEFAULT_TWO_DIGIT_YEAR_START;
Date headerDateValue; try { headerDateValue = DateUtils.parseDate(headerValue); if (resource instanceof IResource) { IResource iResource = (IResource) resource;
response.addHeader(Constants.HEADER_LAST_MODIFIED, DateUtils.formatDate(lastUpdated.getValue()));
/** * Formats the given date according to the specified pattern. The pattern * must conform to that used by the {@link SimpleDateFormat simple date * format} class. * * @param date The date to format. * @param pattern The pattern to use for formatting the date. * @return A formatted date string. * * @throws IllegalArgumentException If the given date pattern is invalid. * * @see SimpleDateFormat */ public static String formatDate(final Date date, final String pattern) { notNull(date, "Date"); notNull(pattern, "Pattern"); final SimpleDateFormat formatter = DateFormatHolder.formatFor(pattern); return formatter.format(date); }
Date ifModifiedSinceDate = DateUtils.parseDate(ifModifiedSince); Date lastModified = null; if (responseResource instanceof IResource) {
response.addHeader(Constants.HEADER_LAST_MODIFIED, DateUtils.formatDate(lastUpdated.getValue()));
final String[] dateFormats, final Date startDate) { notNull(dateValue, "Date value"); final String[] localDateFormats = dateFormats != null ? dateFormats : DEFAULT_PATTERNS; final Date localStartDate = startDate != null ? startDate : DEFAULT_TWO_DIGIT_YEAR_START;
/** * 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); }
/** * 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); }
Date headerDateValue; try { headerDateValue = DateUtils.parseDate(headerValue); if (resource instanceof IResource) { IResource iResource = (IResource) resource;
Date ifModifiedSinceDate = DateUtils.parseDate(ifModifiedSince); Date lastModified = null; if (responseResource instanceof IResource) {