Parsing a string to date gives 01/01/0001 00:00:00
- by kawtousse
String dateimput=request.getParameter("datepicker");
System.out.printl("datepicker:" +dateimput);
DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
Date dt = null;
try
{
dt = df.parse(dateimput);
System.out.println("date imput is:" +dt);
} catch (ParseException e)
{
e.printStackTrace();
}
*datepicker:04/29/2010 (value I currently selected from datepicker).
*the field in database is typed date.
1-date imput is:Thu Apr 29 00:00:00 CEST 2010
and in database level it is inserted like that 01/01/0001 00:00:00