DateTimeUtils { public static String calendarToXSDDateString(Calendar cal) { String x = calendarToXSDString(cal, dateFmt_yyyymmdd) ; if ( x.endsWith("Z") ) x = x.substring(0, x.length()-1)+"+00:00"; return x; }  static String nowAsXSDDateTimeString(); static String todayAsXSDDateString(); static String nowAsString(); static String nowAsString(String formatString); static String nowAsString(DateTimeFormatter dateFormat); static String calendarToXSDDateTimeString(Calendar cal); static String calendarToXSDDateString(Calendar cal); static String calendarToXSDTimeString(Calendar cal);  }
@Test public void testCalendarToXSDDateString() { Calendar cal = createCalendar(1984, Calendar.MARCH, 22, 23, 59, 1, 0, "Z"); cal.setTimeZone(TimeZone.getTimeZone("Z")) ; assertEquals("1984-03-22+00:00", DateTimeUtils.calendarToXSDDateString(cal)); cal.setTimeZone(TimeZone.getTimeZone("MST")); assertEquals("1984-03-22-07:00", DateTimeUtils.calendarToXSDDateString(cal)); }