title: Failed to convert property value of type [java.lang.String] to required type [java.util.Date] with @DateTimeFormat(pattern = "HH:mm")
body: <p>im trying to validate a @DateTimeFormat(pattern="HH:mm") generated with JQuery Timepicker on Spring 4.3, and i have a problem when i send the data object to the controller, this generate a exception.</p>
  
  <pre><code>Failed to convert property value of type [java.lang.String] to required type [java.util.Date] for property schedule.shChildTime; nested exception is java.lang.IllegalArgumentException: Could not parse date: Unparseable date: "00:00"
  </code></pre>
  
  <p>The attribute on data base is:</p>
  
  <pre><code>sh_child_time time without time zone NOT NULL DEFAULT '00:00:00'::time without time zone
  </code></pre>
  
  <p>Hibernate reverse engineering make the class mapping and i add the notation, the attributes Schedule class is:</p>
  
  <pre><code>private boolean shHappen;
  private char shStatus;
  private short shOrder;
  @DateTimeFormat(pattern = "HH:mm")
  private Date shChildTime;
  private int[][] shOrderMatrix;
  </code></pre>
  
  <p>The controller is receiving a Schedule object across the ModelAttribute:</p>
  
  <pre><code>@RequestMapping(value = "/schedules/new", method = RequestMethod.POST)
  public String saveSchedule(@ModelAttribute("persistDto")Schedule schedule, BindingResult result,Model model,Locale locale,HttpServletRequest request) {}
  </code></pre>
  
  <p>The form object is, <b>th:object="${persistDto}"</b> and the input with thymeleaf is:</p>
  
  <pre><code>&lt;input th:field="*{schedule.shChildTime}" type="text" class="form-control" id="inputShChildTime" th:placeholder="#{schedule.hour.real}"/&gt;
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The solution is add a InitBinder on the controller with the data date format that i send on the model and format the data in the fields on the front end:</p>
  
  <pre><code>@InitBinder
      public void initBinder(WebDataBinder binder) {
          SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
          binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
      }
  </code></pre>
  
  <p>Example data format: "2017-01-01 12:00:12"</p>