我正在尝试使用datetimepicker从jsp页面发送两个日期值作为参数。不管我在springtimepicker中从spring弹出控制器中的jsp页面引入的日期我总是得到Sun Jan 01 16:36:00 EET 2017.时间有效,但日期始终是当年的第一天。
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat sdf = new SimpleDateFormat("DD/MM/YYYY HH:mm");
sdf.setLenient(true);
binder.registerCustomEditor(Date.class, new CustomDateEditor(sdf, true));
}
脚本:
<script>$(function() {
$(".datepicker-1").datetimepicker({
format: 'DD/MM/YYYY HH:mm',
});
});</script>
我尝试在jsp代码中使用dd / MM / yyyy来处理datetimepicker和initBinder方法,但是我收到了错误。