code: public Object toObject(String pString, Class pType, String pFormat) throws ConversionException {
          if (StringUtil.isEmpty(pString))
              return null;
  
          try {
              DateFormat format;
  	    
              if (pFormat == null) {
                  // Use system default format, using default locale
                  format = DateFormat.getDateTimeInstance();
              }
              else {
                  // Get format from cache
                  format = getDateFormat(pFormat);
              }
              
              Date date =  StringUtil.toDate(pString, format);
  
              // Allow for conversion to Date subclasses (ie. java.sql.*)
              if (pType != Date.class) {
                  try {
                      date = (Date) BeanUtil.createInstance(pType, new Long(date.getTime()));
                  }
                  catch (ClassCastException e) {
                      throw new TypeMismathException(pType);
                  }
                  catch (InvocationTargetException e) {
                      throw new ConversionException(e);
                  }
              }
  
              return date;
          }
          catch (RuntimeException rte) {
              throw new ConversionException(rte);
          }
      }
docs: Converts the string to a date, using the given format for parsing.
  
  @param pString the string to convert.
  @param pType the type to convert to. {@code java.util.Date} and
  subclasses allowed.
  @param pFormat the format used for parsing. Must be a legal
  {@code SimpleDateFormat} format, or {@code null} which will use the
  default format.
  
  @return the object created from the given string. May safely be typecast
  to {@code java.util.Date}
  
  @see Date
  @see java.text.DateFormat
  
  @throws ConversionException