0

I want to represent date in the format MM-DD-YYYY as Day, Month Date

For example - represent 5-12-2015 as Tuesday, May 12. How can I do this?

halfer
  • 19,824
  • 17
  • 99
  • 186
rickygrimes
  • 2,637
  • 9
  • 46
  • 69
  • Show what you have tried ? – Kevin Andrid May 13 '15 at 04:47
  • Parse the `String` value using [`SimpleDateFormat`](http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html), format the resulting date using a [`SimpleDateFormat`](http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html) – MadProgrammer May 13 '15 at 04:47

1 Answers1

2

Though I am giving you the code to do this, you should first show us your efforts.

String date = "5-12-2015";
DateFormat format = new SimpleDateFormat("MM-dd-yyyy");
Date d = format.parse(date);
DateFormat format1 = new SimpleDateFormat("EEEE, MMM dd");
String finalDateString = format1.format(d);
System.out.println(finalDateString);
Aakash
  • 2,029
  • 14
  • 22