I have to parse a string that can contain date in any format. Currently I have set a list of predefined formats like this:
List<String> dateFormatsList =["MMddyy",'MM/dd/yyyy', 'MM-dd-yyyy',"MMM-yyyy","MMM-yy","MMMM-yy"] ;
Each format is tried on a given input string like this:
result = DateFormat(format).parse(str_input);
But there can be many more date formats than those in the list.
Therefore I am trying to think of a way to parse a date in any format with specify a list of predefined formats.
Feel free to share if you have any ideas.
Thanks