[英]Spring Mvc Wrong Date Format
我尝试使用粘合剂这样的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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.