-1
SimpleDateFormat parser = new SimpleDateFormat("EEEE, MM dd, yyyy");
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
Date date;
date = parser.parse(date1);
output = formatter.format(date);

date 1 is "Sunday, March 3, 2013"

Muhsina M
  • 21
  • 2
  • 8

1 Answers1

1

I think this is what you need:

SimpleDateFormat parser = new SimpleDateFormat("EEE, MMM dd, yyyy");

EEE is for the day of the week and MMM is for month in the long format.

You should take a look at the documentation of SimpleDateFormat.

  • No. MMM is for the month name in abbreviated format. And EEE is for the day name in abbreviated format. – JB Nizet Mar 03 '13 at 17:18