1

Possible Duplicate:
Java string to date conversion

Hi, how would I convert a string, for example "5/22/2011" into Sunday, May 22?

Thanks in advance!

Community
  • 1
  • 1
Andrew
  • 85
  • 1
  • 4

2 Answers2

2

Try:

Date d = new SimpleDateFormat("MM/dd/yyyy").parse("5/22/2011");
String s = new SimpleDateFormat("EEEE, MMMM dd").format(d);
morja
  • 8,297
  • 2
  • 39
  • 59
0

Take a look at the class SimpleDateFormat The javadoc give a good description of the parameters

You can use one format to convert into a java Date object and then another to convert back into the second string

Aaron
  • 5,931
  • 4
  • 27
  • 31