First of all, you should not use the constructor Date(String), as it's deprecated. What you need here is to first parse the date string using a format to convert it to a Date object, and then format that Date object to the required format.
The following code would work:
String dateString = "1st August 2012";
// Format for parsing the dateString
SimpleDateFormat parser = new SimpleDateFormat("d'st' MMM yyyy");
// To format the resultant Date object to new String format
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
try {
dateString = formatter.format(parser.parse(dateString));
} catch(Exception e) {
e.printStackTrace();
}
System.out.println(dateString);
I would suggest you to move towards JodaTime, a much powerful DateTime API than Java's Date and Calendar. You will be surprised how easy it is to work with dates with that. In fact Java 8 introduces a completely new datetime API based on JodaTime only.
SimpleDateFormatinstance for parsing the give dateString