I use a jquery datepicker then i read it in my servlet like that:
String dateimput=request.getParameter("datepicker");//1 then parse it like that:
System.out.println("datepicker:" +dateimput);
DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
java.util.Date dt = null;
try
{
dt = df.parse(dateimput);
System.out.println("date imput parssé1 est:" +dt);
System.out.println("date imput parsée2 est:" +df.format(dt));
} catch (ParseException e)
{
e.printStackTrace();
}
and insert query like that:
String query = "Insert into dailytimesheet(trackingDate,activity,projectCode) values ("+df.format(dt)+", \""+activity+"\" ,\""+projet+"\")";
it pass successfully untill now but if i check the record inserted i found the date: 01/01/0001 00:00:00
l've tried to fix it but it still a mess for me.