question: public Date parse ( String text ) throws ParserException { text = text . trim ( ) ; int length = text . length ( ) ; if ( length == LONG_DATE_FORMAT . length ( ) ) { return parse ( text , LONG_DATE_FORMAT ) ; } if ( length == MEDIUM_DATE_FORMAT . length ( ) ) { return parse ( text , MEDIUM_DATE_FORMAT ) ; } return parse ( text , SHORT_DATE_FORMAT ) ; }
target:  Will try to parse the date with Locale.US and formats as follows: yyyy-MM-dd HH:mm:ss.SSS, yyyy-MM-dd HH:mm:ss and yyyy-MM-dd