HttpDateUtils { static Date parse(String headerName, String value) { String lowerCasedHeaderName = headerName.toLowerCase(Locale.ROOT); if ("date".equals(lowerCasedHeaderName) || "last-modified".equals(lowerCasedHeaderName)) { Date date = tryParse(value, RFC2616_DATE_FORMATS.get()); if (date == null) { LOG.warn("Could not create Date instance from rfc2616 format: " + value); } return date; } Date date = tryParse(value, RFC3339_DATE_FORMATS.get()); if (date == null) { LOG.warn("Could not create Date instance from rfc3339 format: " + value); } return date; }  static String format(Date date);  }
@Test public void dateHeader_rfc1123() { Date date = HttpDateUtils.parse("Date", "Sun, 06 Nov 1994 08:49:37 GMT"); assertEquals(784111777000L, date.getTime()); }
@Test public void dateHeader_rfc1036() { Date date = HttpDateUtils.parse("Date", "Sunday, 06-Nov-94 08:49:37 GMT"); assertEquals(3939871777000L, date.getTime()); }
@Test public void lastModifiedHeader_ansiC() { Date date = HttpDateUtils.parse("Date", "Sun Nov 6 08:49:37 1994"); assertEquals(784111777000L, date.getTime()); }
@Test public void otherDateHeader_rfc3339_dateTime_withMillis_utc() { Date date = HttpDateUtils.parse("other-date", "1985-04-12T23:20:50.052Z"); assertEquals(482196050052L, date.getTime()); }
@Test public void otherDateHeader_rfc3339_dateTime_utc() { Date date = HttpDateUtils.parse("other-date", "1985-04-12T23:20:50Z"); assertEquals(482196050000L, date.getTime()); }
@Test public void otherDateHeader_rfc3339_dateTime_withOffset() { Date date = HttpDateUtils.parse("other-date", "1996-12-19T16:39:57-08:00"); assertEquals(851042397000L, date.getTime()); }
@Test public void otherDateHeader_rfc3339_fullDate() { Date date = HttpDateUtils.parse("other-date", "1996-12-19"); assertEquals(850953600000L, date.getTime()); }