I'm using SimpleDateFormat
with pattern "MM"
and try to parse "0012"
.
Even with leniency disabled the formatter will successfully parse this to december. I'd like it to throw an exception, this is no 2-digit-month. Does anyone know how to achieve that?
Code
Example code:
SimpleDateFormat df = new SimpleDateFormat( "MM");
df.setLenient( false);
System.out.println( df.parse( "0012"));
Output:
Tue Dec 01 00:00:00 CET 1970