IndexUtils { public static String serializeDate(Date date) { if (date == null) return null; return dateFormat.format(date); } private  IndexUtils(); static String clean(String q); static String serializeDate(Date date); static String serializeDateRange(Date startDate, Date endDate);  }
@Test public void testSerializeDate() { Calendar d = Calendar.getInstance(); d.set(Calendar.DAY_OF_MONTH, 2); d.set(Calendar.HOUR, 5); d.set(Calendar.HOUR_OF_DAY, 5); d.set(Calendar.MINUTE, 59); d.set(Calendar.SECOND, 13); d.set(Calendar.MILLISECOND, 0); Date date = d.getTime(); String serializedDate = df.format(date) + "T05:59:13Z"; assertEquals(serializedDate, IndexUtils.serializeDate(date)); }