Hello guys i'm new to this forums and I hope someone can help me, I have this switch:
String arrivalDate;
arrivalDate = "20 Nov 2013";
String input = arrivalDate;
Date d;
switch (arrivalDate) {
case "dd MMM yyyy":
d = new SimpleDateFormat("dd MMM yyyy", Locale.US).parse(input);
break;
case "dd-MMMM-yyyy":
d = new SimpleDateFormat("dd-MMMM-yyyy", Locale.US).parse(input);
break;
case "ddMMMMyyyy":
d = new SimpleDateFormat("ddMMMMyyyy", Locale.US).parse(input);
break;
case "dd-MMMM-yy":
d = new SimpleDateFormat("dd-MMMM-yy", Locale.US).parse(input);
break;
case "dd/MMMM/yy":
d = new SimpleDateFormat("dd/MMMM/yy", Locale.US).parse(input);
break;
default:
d = new SimpleDateFormat("MM/dd/yyyy", Locale.US).parse(input);
break;
}
String output = new SimpleDateFormat("MM/dd/yyyy").format(d);
System.out.println("this " + output);
}
It always go rigth to the default and well it sends me a parse error, why is this I have tryed to make it work but it doesn't thanks in advance guys
