I want to change
"01-Jun-2016 07:54 AM"
to
"26th May,2016"
Here is my code
DateFormat df = new SimpleDateFormat("MMM dd, yyyy", Locale.ENGLISH);
DateFormat existinFormat= new SimpleDateFormat("dd-MMM-yyyy HH:mm aa " , Locale
.ENGLISH);
Calendar c = Calendar.getInstance();
String newDateString = "";
Date startDate = null;
try {
startDate = existinFormat.parse((date));
newDateString = df.format(startDate);
} catch (ParseException e) {
e.printStackTrace();
}
but its throws parse exception :
java.text.ParseException: Unparseable date: "01-Jun-2016 07:54 AM" (at offset 20)
If any one found this solution please share with me.