This question already has an answer here:
- How can I change the date format in Java? 10 answers
I have a string something like date month year(31 08 2012) . I want to convert it to date format.
String string = "31082012";
Date date = new SimpleDateFormat("DDMMYYYY").parse(string);
System.out.println(date);