HI all,
I want to change a calendar object to a
String. I am getting a Calendar from a bean and I want to change it to "ddMMM" date format adn then convert it to String.
I am using the following code but it gives me error cannot cast from Calendar to Date.. How can i achieve it. Please help me.
Calendar calendarDepartureDT=Calendar.getInstance();
calendarDepartureDT=segment.getDepartureDateTime();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Date strDate1=calendarDepartureDT;
String strDate=formatter.format(calendarDepartureDT);
Date date = formatter.parse(strDate1);
String strCorrectedDate = new SimpleDateFormat("ddMMM").format(date);
Please help..