Reputation: 35
I want to get date in the format of MMyyyy and here is my code
SimpleDateFormat sdf = new SimpleDateFormat("MMyyyy");
String d="02-2014";
Date d1=sdf.parse(d);
System.out.println("the date is:" +d1);
As my string is not in a given format it should throw an exception but it is giving an output like
the date is:Sat Jun 01 00:00:00 IST 2272
Help me out
Upvotes: 1
Views: 73