Hi ,Use the below method to change the date format of expected date format..
\public class TimeFormat{
public Calendar ConvertToCalenderFormat(String stringInstanceRepresentingDate,String Format){
Calendar cal = null;
try{
if(stringInstanceRepresentingDate!=null && !stringInstanceRepresentingDate.equalsIgnoreCase("")){
DateFormat df = new SimpleDateFormat(Format);
cal = Calendar.getInstance();
cal.setTime(df.parse(stringInstanceRepresentingDate));
System.out.println(cal.getTime());
}
}
catch(Exception e){
e.printStackTrace();
}
return cal;
}
public String formatCalender(Calendar cal,String Formater){
SimpleDateFormat format1 = new SimpleDateFormat(Formater);
String formatted = format1.format(cal.getTime());
return formatted;
}
public static String covnertToDateFormat(String date)
{
Calendar cal=this.ConvertToCalenderFormat(date, "yyyy-MM-dd");
return this.formatCalender(cal, "dd/MM/yyyy");
}
}
}
\public class TimeFormat{
public Calendar ConvertToCalenderFormat(String stringInstanceRepresentingDate,String Format){
Calendar cal = null;
try{
if(stringInstanceRepresentingDate!=null && !stringInstanceRepresentingDate.equalsIgnoreCase("")){
DateFormat df = new SimpleDateFormat(Format);
cal = Calendar.getInstance();
cal.setTime(df.parse(stringInstanceRepresentingDate));
System.out.println(cal.getTime());
}
}
catch(Exception e){
e.printStackTrace();
}
return cal;
}
public String formatCalender(Calendar cal,String Formater){
SimpleDateFormat format1 = new SimpleDateFormat(Formater);
String formatted = format1.format(cal.getTime());
return formatted;
}
public static String covnertToDateFormat(String date)
{
Calendar cal=this.ConvertToCalenderFormat(date, "yyyy-MM-dd");
return this.formatCalender(cal, "dd/MM/yyyy");
}
}
}