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"
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"
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
.