try this one...
Calendar c = Calendar.getInstance();
SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
String formatDate = df.format(c.getTime());
System.out.print(formatDate);
if you want to change vice versa means follow below steps..
int selectedYear = 2013;
int selectedDay = 20;
int selectedMonth = 11;
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, selectedYear);
cal.set(Calendar.DAY_OF_MONTH, selectedDay);
cal.set(Calendar.MONTH, selectedMonth);
String format = new SimpleDateFormat("E, MMM d, yyyy").format(cal.getTime());
or else
DateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.ENGLISH);
or
GregorianCalendar cal = new GregorianCalendar();
int y, m, d, a;
y = cal.get(Calendar.YEAR);
m = cal.get(Calendar.MONTH) + 1;
d = cal.get(Calendar.DAY_OF_MONTH);
cal.set(_year, _month, _day);
String format = new SimpleDateFormat("E, MMM d, yyyy").format(cal.getTime());
hope it will help you
你的解決方案是差不多吧,看我的答案;-) –