SimpleDateFormat pattern is “yyyyMM”, and the arg is yyyy-MM, but there are no exception and a wrong result. why? thx~~
SimpleDateFormat format = new SimpleDateFormat("yyyyMM");
System.out.println(format.format(format.parse("2011-07")));
the result is 201105
Use
setLenient(false); it will then throw the exception you expect.See the setLenient() docs.