convert string datatype to date format
hi
how can i convert string datatype to Date format to insert to the database
I am getting two string values from a Jsp/Html form which are in
yyyy-mm-dd format. i need to insert them in oracle database
for example i am doing the following:
String date1 = request.getParameter("sdate");
String date2 = request.getParameter("edate");
from this how can i get?
[411 byte] By [
sunvenkata] at [2007-11-27 9:37:18]

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
.
.
.
try {
DateFormat formatter = new SimpleDateFormat("yyyy-mm-dd");
Date date = (Date) formatter.parse("2006-10-02");
System.out.println(date);
} catch (ParseException e) {
// TODO: handle exception
} catch (Exception e) {
// TODO: handle exception
}