title: Wrong date format when submit Spring form
body: <p>I have a project where I use Spring MVC and Thymeleaf.
  I need to display dates with a different format for each user based on his preferences.
  For exemple, UserA want to display dates like MM/dd/yyyy and UserB want to display dates like dd/MM/yyyy.</p>
  
  <p>To do this, I use this thymeleaf parameter:</p>
  
  <pre><code>th:value="${#dates.format(myDate, dateFormat)}"
  </code></pre>
  
  <p>The value "dateFormat" is based on the user preference. This works fine.</p>
  
  <p>My problem is that the date input is in a form, and when I submit the form, it doesn't take the good format. I always get MM/dd/yyyy.</p>
  
  <p>If I choose the format dd/MM/yyyy and enter 18/01/2016, in my spring controller I obtain "Thu Jun 01 00:00:00 CEST 2017" which correspond to 01/06/2017 in dd/MM/yyyy.</p>
  
  <p>What can I do to have the date with the format that I want?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;form th:action="@{/test}" th:object="${filter}" th:method="POST"&gt;
      &lt;input type="date" th:type="date" class="form-control" th:id="myDate"
             th:name="myDate" th:value="${#dates.format(filter.myDate, dateFormat)}"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>@RequestMapping(value = "/test", method = RequestMethod.POST)
  public String myTest(@ModelAttribute Filter filter, Model model) {
  
      Systeme.out.println(model.dateFormat);
      // dd/MM/yyyy
  
      Systeme.out.println(filter.myDate.toString());
      // Thu Jun 01 00:00:00 CEST 2017
  
      return "test";
  }
  </code></pre>