code: public static Date stringTodate(String dateString, String format) throws ParseException {
          final DateFormat dateFormat = new SimpleDateFormat(format, Locale.US);
          return dateFormat.parse(dateString);
      }
docs: Convert string to date.
  
  @param dateString the date string
  @param format the format
  @return the date
  @throws ParseException the parse exception