public static Date getDateFromString(final String dateString, final String pattern) {

    try {
      SimpleDateFormat df = buildDateFormat(pattern);
      return df.parse(dateString);
    } catch (ParseException e) {
      throw new DateException(String.format("Could not parse %s with pattern %s.", dateString,
        pattern), e);
    }
  }
public static Date getDateFromString ( final String dateString , final String pattern ) { try { SimpleDateFormat df = buildDateFormat ( pattern ) ; return df . parse ( dateString ) ; } catch ( ParseException e ) { throw new DateException ( String . format ( "Could not parse %s with pattern %s." , dateString , pattern ) , e ) ; } }
Get data from data string using the given pattern and the default date
format symbols for the default locale.

@param dateString date string to be handled.
@param pattern pattern to be formated.
@return a new Date object by given date string and pattern.
@throws DateException