Try this:
new SimpleDateFormat("MM/dd/yyyy")
MMis “month” (notmm)ddis “day” (notDD)
It’s all in the javadoc for SimpleDateFormat
FYI, the reason your format is still a valid date format is that:
mmis “minutes”DDis “day in year”
Also, you don’t need the cast to Date… it already is a Date (or it explodes):
public static void main(String[] args) throws ParseException {
System.out.println(new SimpleDateFormat("MM/dd/yyyy").parse("08/16/2011"));
}
Output:
Tue Aug 16 00:00:00 EST 2011
Voila!