public static String formatRfc822Date(Date date) { return DateUtils.formatRFC822Date(date); }
public static String fromDate(Date date, String timestampFormat) { if ("unixTimestamp".equalsIgnoreCase(timestampFormat)) { return DateUtils.formatServiceSpecificDate(date); } if ("iso8601".equalsIgnoreCase(timestampFormat)) { return DateUtils.formatISO8601Date(date); } if ("rfc822".equalsIgnoreCase(timestampFormat)) { return DateUtils.formatRFC822Date(date); } if ("unixTimestampInMillis".equalsIgnoreCase(timestampFormat)) { return DateUtils.formatUnixTimestampInMills(date); } throw new IllegalArgumentException("unsupported timestamp format"); }
@Override public StructuredJsonGenerator writeValue(Date date, TimestampFormat timestampFormat) { try { switch (timestampFormat) { case UNIX_TIMESTAMP_IN_MILLIS: generator.writeNumber(DateUtils.formatUnixTimestampInMills(date)); break; case ISO_8601: generator.writeString(DateUtils.formatISO8601Date(date)); break; case RFC_822: generator.writeString(DateUtils.formatRFC822Date(date)); break; case UNIX_TIMESTAMP: default: generator.writeNumber(DateUtils.formatServiceSpecificDate(date)); } } catch (IOException e) { throw new JsonGenerationException(e); } return this; }
request.addHeader(Headers.EXPIRES, DateUtils.formatRFC822Date(httpExpiresDate));
String date = DateUtils.formatRFC822Date(dateValue); boolean isHttps = false;
/** * Formats an instance of Date to RFC-822. * @param date Date * @return date in RFC-822 format. */ public static String formatRfc822Date(Date date) { return DateUtils.formatRFC822Date(date); }
public static String fromDate(Date date, String timestampFormat) { if ("unixTimestamp".equalsIgnoreCase(timestampFormat)) { return DateUtils.formatServiceSpecificDate(date); } if ("iso8601".equalsIgnoreCase(timestampFormat)) { return DateUtils.formatISO8601Date(date); } if ("rfc822".equalsIgnoreCase(timestampFormat)) { return DateUtils.formatRFC822Date(date); } if ("unixTimestampInMillis".equalsIgnoreCase(timestampFormat)) { return DateUtils.formatUnixTimestampInMills(date); } throw new IllegalArgumentException("unsupported timestamp format"); }
@Override public StructuredJsonGenerator writeValue(Date date, TimestampFormat timestampFormat) { try { switch (timestampFormat) { case UNIX_TIMESTAMP_IN_MILLIS: generator.writeNumber(DateUtils.formatUnixTimestampInMills(date)); break; case ISO_8601: generator.writeString(DateUtils.formatISO8601Date(date)); break; case RFC_822: generator.writeString(DateUtils.formatRFC822Date(date)); break; case UNIX_TIMESTAMP: default: generator.writeNumber(DateUtils.formatServiceSpecificDate(date)); } } catch (IOException e) { throw new JsonGenerationException(e); } return this; }
request.addHeader(Headers.EXPIRES, DateUtils.formatRFC822Date(httpExpiresDate));
@Ignore("Joda has issue handling format string 'z'") @Test public void testRfc822Date() { Date date = new Date(); String expected = rfc822DateFormat.print(date.getTime()); String actual = DateUtils.formatRFC822Date(date); assertEquals(expected, actual); Date expectedDate = new Date(rfc822DateFormat.parseMillis(expected)); Date actualDate = DateUtils.parseRFC822Date(actual); assertEquals(expectedDate, actualDate); }
@Test public void tt0031561767() throws ParseException { String input = "Fri, 16 May 2014 23:56:46 GMT"; Date date = DateUtils.parseRFC822Date(input); assertEquals(input, DateUtils.formatRFC822Date(date)); }
/** * Formats an instance of Date to RFC-822. * @param date Date * @return date in RFC-822 format. */ public static String formatRfc822Date(Date date) { return DateUtils.formatRFC822Date(date); }
String date = DateUtils.formatRFC822Date(dateValue); boolean isHttps = false;
String date = DateUtils.formatRFC822Date(dateValue); boolean isHttps = false;
public static String formatRfc822Date(Date date) { return DateUtils.formatRFC822Date(date); }
request.addHeader(Headers.EXPIRES, DateUtils.formatRFC822Date(httpExpiresDate));
request.addHeader(Headers.EXPIRES, DateUtils.formatRFC822Date(httpExpiresDate));
String date = DateUtils.formatRFC822Date(dateValue); boolean isHttps = false;
String date = DateUtils.formatRFC822Date(dateValue); boolean isHttps = false;
String date = DateUtils.formatRFC822Date(dateValue); boolean isHttps = false;