break the date string first then take the month as an
integer.example.Compare with 12. If it is greater than 12 then it must
be a date, not a month. Then just change the format as per your needSee
how to change the date
But in your case, you can take multiple date pattern so that any date
pattern will be valid to pass the validation check.