public static Date convertStringToDate(String aMask,String strDate) throws ParseException {
  SimpleDateFormat df;
  Date date;
  df=new SimpleDateFormat(aMask);
  if (log.isDebugEnabled()) {
    log.debug("converting '" + strDate + "' to date with mask '"+ aMask+ "'");
  }
  try {
    date=df.parse(strDate);
  }
 catch (  ParseException pe) {
    throw new ParseException(pe.getMessage(),pe.getErrorOffset());
  }
  return (date);
}

public static Date convertStringToDate ( String aMask , String strDate ) throws ParseException { SimpleDateFormat df ; Date date ; df = new SimpleDateFormat ( aMask ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "converting '" + strDate + "' to date with mask '" + aMask + "'" ) ; } try { date = df . parse ( strDate ) ; } catch ( ParseException pe ) { throw new ParseException ( pe . getMessage ( ) , pe . getErrorOffset ( ) ) ; } return ( date ) ; }
this method generates a string representation of a date / time in the format you specify on input
