Java Date conversion [duplicate]
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!
Try:
Date d = new SimpleDateFormat("MM/dd/yyyy").parse("5/22/2011");
String s = new SimpleDateFormat("EEEE, MMMM dd").format(d);
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
精彩评论