I am getting date in two different formats.
1) 2012-01-05
2) 05/01/2012
But I want this to be in the below format. \"5 Jan 2011\"
String d1 = "2012-01-05";
String d2 = "05/01/2012";
SimpleDateFormat curFormater1 = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat curFormater2 = new SimpleDateFormat("dd/MM/yyyy");
Date dateObj1 = null;
Date dateObj2 = null;
try {
dateObj1 = curFormater.parse(d1);
dateObj2 = curFormater.parse(d2);
} catch (ParseException e) {
e.printStackTrace();
}
SimpleDateFormat formatter = new SimpleDateFormat("dd MMM yyyy");
String date_new1 = formatter.format(d1);
String date_new2 = formatter.format(d2);
try this code it will help you so solve your problem