I'm getting a date keyed in by users and am having a problem understanding SimpleDateFormat. If the user types in a date in the format "mm/dd/yy" and SimpleDateFormat is set to SHORT everything works ok. If the user types in a date in "mm/dd/yyyy", then SimpleDateFormat gives me a ParseException regardless of the style (SHORT, MEDUIM, LONG, FULL). Is there a way to validate a user entered date which could be in one of the following three formats: mm/dd/yy, mm/dd/yyyy or yyyy/mm/dd where the slashes could also be dashes (mm-dd-yyyy). Do I need to write a
string parsing routine which will strip the first two digits from the year if the year is 4 digits and re-arrange the string so that the year is in the last position? I am in local US.