If your system uses a language other than English, you need to use this constructor:
SimpleDateFormat(DATE_FORMAT,Locale.ENGLISH);
If this is not a problem, you should format the date using the same formatter and compare the result with your input string.
source share