/** * 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. * * <p> * 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); }
/** * Parses an ISO8601 string and converts it to a {@link Date}. * * @param s The string to parse. * @return The parsed value, or <jk>null</jk> if the string was <jk>null</jk> or empty. */ public static Date parseISO8601(String s) { if (isEmpty(s)) return null; return DatatypeConverter.parseDateTime(toValidISO8601DT(s)).getTime(); }
public static F2 create() { F2 x = new F2(); x.setC(parseISO8601Calendar("2018-12-12T05:12:00")); return x; } }
/** * This shows an example generated from a static method. */ @Example public static Order example() { return new Order() .id(123) .username("sampleuser") .petId(456) .status(OrderStatus.APPROVED) .shipDate(DateUtils.parseISO8601("2020-10-10")) ; } }
/** * Parses an ISO8601 string and converts it to a {@link Date}. * * @param s The string to parse. * @return The parsed value, or <jk>null</jk> if the string was <jk>null</jk> or empty. */ public static Date parseISO8601(String s) { if (isEmpty(s)) return null; return DatatypeConverter.parseDateTime(toValidISO8601DT(s)).getTime(); }
public static F1 create() { F1 x = new F1(); x.setC(parseISO8601Calendar("2018-12-12T05:12:00")); return x; } }
/** * This shows an example generated from a static method. */ @Example public static Order example() { return new Order() .id(123) .username("sampleuser") .petId(456) .status(OrderStatus.APPROVED) .shipDate(DateUtils.parseISO8601("2020-10-10")) ; } }
/** * 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. * * <p> * 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); }
/** * Parses an ISO8601 string and converts it to a {@link Date}. * * @param s The string to parse. * @return The parsed value, or <jk>null</jk> if the string was <jk>null</jk> or empty. */ public static Date parseISO8601(String s) { if (isEmpty(s)) return null; return DatatypeConverter.parseDateTime(toValidISO8601DT(s)).getTime(); }
/** * 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. * * <p> * 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); }
/** * Parses an ISO8601 string and converts it to a {@link Calendar}. * * @param s The string to parse. * @return The parsed value, or <jk>null</jk> if the string was <jk>null</jk> or empty. */ public static Calendar parseISO8601Calendar(String s) { if (isEmpty(s)) return null; return DatatypeConverter.parseDateTime(toValidISO8601DT(s)); }
@Override /* HttpServletResponse */ public void setDateHeader(String name, long date) { headerMap.put(name, new String[] {DateUtils.formatDate(new Date(date), DateUtils.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); }
/** * Parses an ISO8601 string and converts it to a {@link Calendar}. * * @param s The string to parse. * @return The parsed value, or <jk>null</jk> if the string was <jk>null</jk> or empty. */ public static Calendar parseISO8601Calendar(String s) { if (isEmpty(s)) return null; return DatatypeConverter.parseDateTime(toValidISO8601DT(s)); }
@Override /* HttpServletResponse */ public void setDateHeader(String name, long date) { headerMap.put(name, new String[] {DateUtils.formatDate(new Date(date), DateUtils.PATTERN_RFC1123)}); }
/** * Constructor. * * @param raw The raw header value. */ protected HeaderDate(String raw) { this.raw = raw; this.date = DateUtils.parseDate(raw); }
/** * Parses an ISO8601 string and converts it to a {@link Calendar}. * * @param s The string to parse. * @return The parsed value, or <jk>null</jk> if the string was <jk>null</jk> or empty. */ public static Calendar parseISO8601Calendar(String s) { if (isEmpty(s)) return null; return DatatypeConverter.parseDateTime(toValidISO8601DT(s)); }