I need to format my date (in Java) which is in String format. When I use the following code, taken from an tutorial/reference source, it just gives the following error. I have tried everything I can think of.
My code:
SimpleDateFormat format = new SimpleDateFormat ("E dd/MMM/yy");
java.util.Date date = format.parse ("12/31/2006");
System.out.println (date);
This results in the following error:
java.text.ParseException: Unparseable date: "12/31/2006"
I am actually trying to format this string "2011-7-27" but it gave the same error, which resulted me in trying that format for the string I feed to it.
Is there anything you can see which I mess up somewhere?