jdk中已经不再推荐用Date.parse(String arg);这样的直接的转换,取而代之的是:
复制内容到剪贴板 程序代码
String birthdayS = request.getParameter("birthday");
DateFormat f=new SimpleDateFormat("yyyy-MM-dd");
try {
birthday=f.parse(birthdayS);
} catch (ParseException e) {
e.printStackTrace();
log.error("When format birthday from String to Date is error");
}
DateFormat f=new SimpleDateFormat("yyyy-MM-dd");
try {
birthday=f.parse(birthdayS);
} catch (ParseException e) {
e.printStackTrace();
log.error("When format birthday from String to Date is error");
}