code: public static Date toDate(final String pString, final DateFormat pFormat) {
          try {
              synchronized (pFormat) {
                  // Parse date using given format
                  return pFormat.parse(pString);
              }
          }
          catch (ParseException pe) {
              // Wrap in RuntimeException
              throw new IllegalArgumentException(pe.getMessage());
          }
      }
docs: Converts the string to a date, using the given format.
  
  @param pString the string to convert
  @param pFormat the date format
  @return the date
  @see SimpleDateFormat
  @see SimpleDateFormat#SimpleDateFormat(String)
  @see DateFormat