SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
Date date = sdf.parse("2018063");
System.out.println(sdf.format(date)); // =>202303
SimpleDateFormat does not throw an exception for a time string that does not match, but converts it to a different kind of time. How to make it throw an exception when it does not conform to the format?