0
我嘗試Spring MVC的日期格式化器使用的粘合劑這樣Spring MVC的錯誤日期格式
@InitBinder
public void binder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(true);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
但我需要格式化"dd-MM-YYYY"
。如果我用這個格式保存的MySQL錯誤的日期
表單數據:07-12-1980
MySQL數據:0013-05-02