-2

Possible Duplicate:
Java string to date conversion

I want to convert String into Date format..How to do it? Normal way i can do it like for "dd-MM-yyyy".. But i want to convert following Strings

String sdate= "Jun 7, 2012 5:40:00 PM "; String edate ="Jun 28, 2012 5:40:00 PM ";

How to do it? Please help!

Community
  • 1
  • 1
sumit
  • 55
  • 5
  • 10

2 Answers2

0

This is the API you should be looking into SimpleDateFormat

Subir Kumar Sao
  • 8,171
  • 3
  • 26
  • 47
0
String edate ="Jun 28, 2012 5:40:00 PM ";
String DATE_FORMAT = "yyyy-MM-dd";
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
String strDateNew = sdf.format(edate);
riya ahuja
  • 260
  • 6
  • 18