I have a method that gets a string and change that to a particular date format but the thing is the date will be any format 
For Example

```none
16 July 2012

March 20 2012

2012 March 20

```

So I need to detect the string is in which file format.

I use the below code to test it but I get exception if the file format changes.

```java
private String getUpdatedDate(String updated) {
        Date date;
        String formatedDate = null;
        try {
            date = new SimpleDateFormat("d MMMM yyyy", Locale.ENGLISH)
                    .parse(updated);
            formatedDate = getDateFormat().format(date);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return formatedDate;
    }

```