写一个方法转换:
Timestamp toTimestamp(String dateString,
  String formatter)
{
SimpleDateFormat sdf = new SimpleDateFormat(formatter, Locale.US);
GregorianCalendar gc = new GregorianCalendar();
try
{
gc.setTime(sdf.parse(dateString));
}
catch (ParseException ex)
{
return null;
}
return new Timestamp(gc.getTime().getTime());
}然后给参数注册:
cs.setInt(n, XXXX.toTimestamp(dataString,"yyyy/MM/dd"));
其中XXXX即为方法toTimestamp()所在的类,dataString为传入的String类型的时间参数。