java.text.DateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd");//"yyyy-MM-dd"日期格式
Date theDate=formatter.parse(searchdate);//searchdate为string类型的日期
public static java.sql.Date getSqlDate(String year, String month, String date) {
int y = 100;
int m = 2;
int d = 1;
if (year != null) {
y = Integer.parseInt(year) - 1900;
}
if (month != null) {
m = Integer.parseInt(month) - 1;
}
if (date != null) {
d = Integer.parseInt(date);
}
java.sql.Date SqlDate = new java.sql.Date(y, m, d);
return SqlDate;
}