Possible Duplicate:
Parse any date in Java
Suppose we have a string of date in a format (unknown to the user). Examples of acceptable dates that you can receive from a user:
yyyy-MM-dd
/yy-MM-dd
yyyy/MM/dd
/yy/MM/dd
dd/MM/yyyy
/dd/MM/yy
MM/dd/yyyy
/MM/dd/
yy`
Is there a library that accept a date in a string and returns a date format that can be used by SimpleDateFormat
or Joda Time?
Thanks
As a simple solution: I will apply each date format on the provided input to get a Date object , then I print the Date object with the same date format. If the input and the output for a date format are the same the date format is a candidate.