@Test public void testFormatDate() { Calendar cal = Calendar.getInstance(); cal.setTimeZone(TimeZone.getTimeZone("UTC")); cal.setTimeInMillis(0); assertEquals("1970-01-01T00:00:00.000Z", DateParser.formatW3CDateTime(cal)); cal.setTimeInMillis(1486660428314L); assertEquals("2017-02-09T17:13:48.314Z", DateParser.formatW3CDateTime(cal)); }
public static String formatW3CDateTime(Date date) { if (date == null) { return null; } Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC")); cal.setTime(date); return formatW3CDateTime(cal); }
DateParser { public static String formatW3CDateTime(Date date) { if (date == null) { return null; } Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC")); cal.setTime(date); return formatW3CDateTime(cal); } }
DateParser { public static String formatW3CDateTime(Date date) { if (date == null) { return null; } Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC")); cal.setTime(date); return formatW3CDateTime(cal); }  }
DateParser { public static String formatW3CDateTime(Date date) { if (date == null) { return null; } Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC")); cal.setTime(date); return formatW3CDateTime(cal); }  static Calendar parse(String str); static Date parseW3CDateTime(String str); static String formatW3CDateTime(Date date); static String formatW3CDateTime(Calendar calendar); }
DateParser { public static String formatW3CDateTime(Date date) { if (date == null) { return null; } Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC")); cal.setTime(date); return formatW3CDateTime(cal); }  static Calendar parse(String str); static Date parseW3CDateTime(String str); static String formatW3CDateTime(Date date); static String formatW3CDateTime(Calendar calendar); static final String W3C_DATE_FORMAT; }