Spring-datetimepicker总是获得相同的日期值

时间:2017-04-24 14:06:11

标签: spring bootstrap-datetimepicker

我正在尝试使用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方法,但是我收到了错误。

0 个答案:

没有答案