public void testDateUtilISO8601() throws Exception {
  ObjectMapper mapper=new ObjectMapper();
  String inputStr="1972-12-28T00:00:00.000+0000";
  Date inputDate=mapper.readValue("\"" + inputStr + "\"",java.util.Date.class);
  Calendar c=Calendar.getInstance(TimeZone.getTimeZone("GMT"));
  c.setTime(inputDate);
  assertEquals(1972,c.get(Calendar.YEAR));
  assertEquals(Calendar.DECEMBER,c.get(Calendar.MONTH));
  assertEquals(28,c.get(Calendar.DAY_OF_MONTH));
  inputStr="1972-12-28T00:00:00.000Z";
  inputDate=mapper.readValue(quote(inputStr),java.util.Date.class);
  c.setTime(inputDate);
  assertEquals(1972,c.get(Calendar.YEAR));
  assertEquals(Calendar.DECEMBER,c.get(Calendar.MONTH));
  assertEquals(28,c.get(Calendar.DAY_OF_MONTH));
  inputStr="1972-12-28T00:00:00.000+00:00";
  inputDate=mapper.readValue(quote(inputStr),java.util.Date.class);
  c.setTime(inputDate);
  assertEquals(1972,c.get(Calendar.YEAR));
  assertEquals(Calendar.DECEMBER,c.get(Calendar.MONTH));
  assertEquals(28,c.get(Calendar.DAY_OF_MONTH));
  inputStr="1972-12-28T00:00:00.000+00";
  inputDate=mapper.readValue(quote(inputStr),java.util.Date.class);
  c.setTime(inputDate);
  assertEquals(1972,c.get(Calendar.YEAR));
  assertEquals(Calendar.DECEMBER,c.get(Calendar.MONTH));
  assertEquals(28,c.get(Calendar.DAY_OF_MONTH));
  inputStr="1984-11-30T00:00:00.000Z";
  inputDate=mapper.readValue(quote(inputStr),java.util.Date.class);
  c.setTime(inputDate);
  assertEquals(1984,c.get(Calendar.YEAR));
  assertEquals(Calendar.NOVEMBER,c.get(Calendar.MONTH));
  assertEquals(30,c.get(Calendar.DAY_OF_MONTH));
}

public void testDateUtilISO8601 ( ) throws Exception { ObjectMapper mapper = new ObjectMapper ( ) ; String inputStr = "1972-12-28T00:00:00.000+0000" ; Date inputDate = mapper . readValue ( "\"" + inputStr + "\"" , java . util . Date . class ) ; Calendar c = Calendar . getInstance ( TimeZone . getTimeZone ( "GMT" ) ) ; c . setTime ( inputDate ) ; assertEquals ( 1972 , c . get ( Calendar . YEAR ) ) ; assertEquals ( Calendar . DECEMBER , c . get ( Calendar . MONTH ) ) ; assertEquals ( 28 , c . get ( Calendar . DAY_OF_MONTH ) ) ; inputStr = "1972-12-28T00:00:00.000Z" ; inputDate = mapper . readValue ( quote ( inputStr ) , java . util . Date . class ) ; c . setTime ( inputDate ) ; assertEquals ( 1972 , c . get ( Calendar . YEAR ) ) ; assertEquals ( Calendar . DECEMBER , c . get ( Calendar . MONTH ) ) ; assertEquals ( 28 , c . get ( Calendar . DAY_OF_MONTH ) ) ; inputStr = "1972-12-28T00:00:00.000+00:00" ; inputDate = mapper . readValue ( quote ( inputStr ) , java . util . Date . class ) ; c . setTime ( inputDate ) ; assertEquals ( 1972 , c . get ( Calendar . YEAR ) ) ; assertEquals ( Calendar . DECEMBER , c . get ( Calendar . MONTH ) ) ; assertEquals ( 28 , c . get ( Calendar . DAY_OF_MONTH ) ) ; inputStr = "1972-12-28T00:00:00.000+00" ; inputDate = mapper . readValue ( quote ( inputStr ) , java . util . Date . class ) ; c . setTime ( inputDate ) ; assertEquals ( 1972 , c . get ( Calendar . YEAR ) ) ; assertEquals ( Calendar . DECEMBER , c . get ( Calendar . MONTH ) ) ; assertEquals ( 28 , c . get ( Calendar . DAY_OF_MONTH ) ) ; inputStr = "1984-11-30T00:00:00.000Z" ; inputDate = mapper . readValue ( quote ( inputStr ) , java . util . Date . class ) ; c . setTime ( inputDate ) ; assertEquals ( 1984 , c . get ( Calendar . YEAR ) ) ; assertEquals ( Calendar . NOVEMBER , c . get ( Calendar . MONTH ) ) ; assertEquals ( 30 , c . get ( Calendar . DAY_OF_MONTH ) ) ; }
iso8601 is supported as well
