I'm parsing user date of birth string. And faced a very strange parsing scenario.
My code is the following:
SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyyy")
try {
Date date = formatter.parse(input); // input - is a user entered string
} catch (ParseException e) {
}
If input
is "22221985", I have a date 22, October, 1986. But I expect some sort of ParseException for this and similar scenario, when month is higher, then 12.