### Question:
DateUtils { public static synchronized Date parseDate(String date) { if(date == null) { return null; } int n = date.length(); if (n > 2 && date.charAt(n - 3) == ':' && (date.charAt(n - 6) == '+' || date.charAt(n - 6) == '-')) { date = date.substring(0, n - 3) + date.substring(n - 2); } for (DateFormat format : iso8601InputFormats) { try { return format.parse(date); } catch (ParseException ignore) { } } return null; }  static synchronized Date parseDate(String date); static Date getDate(XMLGregorianCalendar calendar); static XMLGregorianCalendar getXMLCalendar(Date date); static XMLGregorianCalendar getXMLCalendar(DateTime date); static final SimpleDateFormat ISO8601FORMAT; static final SimpleDateFormat ISO8601FORMAT_TIME; static final SimpleDateFormat ISO8601FORMAT_DATE; static final SimpleDateFormat FILENAME_FORMAT; static final SimpleDateFormat GMTFORMAT; }### Answer:
@Test public void testParseIso8601Date() { Date now = new Date(System.currentTimeMillis()); Assert.assertEquals(now, DateUtils.parseDate(DateUtils.ISO8601FORMAT.format(now))); }
@Test public void testParseFreebaseDate() { String dateString = "1961-08-04T19:24"; Date date = DateUtils.parseDate(dateString); Assert.assertNotNull(date); Assert.assertEquals(61, date.getYear()); }