So, I\'ve been racking my brain over this (should-be) simple exercise to make the program turn a date string into a GregorianCalendar object, format it, and ret
SimpleDateFormat.format() method takes a Date as a parameter. You can get a Date from a Calendar by calling its getTime() method:
public static String format(GregorianCalendar calendar) {
SimpleDateFormat fmt = new SimpleDateFormat("dd-MMM-yyyy");
fmt.setCalendar(calendar);
String dateFormatted = fmt.format(calendar.getTime());
return dateFormatted;
}
Also note that the months start at 0, so you probably meant:
int month = Integer.parseInt(splitDate[1]) - 1;