title: How to reliably accept time input in a Spring form?
body: <p>I have an <code>@Entity</code> with a few <code>java.util.Date</code> fields; two of those should be time formatted. I need a way to accept time, preferably with a picker, for persisting to my db. </p>
  
  <p>I've tried to use, for example,</p>
  
  <pre><code>@DateTimeFormat(pattern="hh:mm a")
  private Date startTime;
  </code></pre>
  
  <p>along with this, and various attempts at adding <code>type="time"</code> and so forth,</p>
  
  <pre><code>...
  &lt;label for="startTime" class="sr-only"&gt;Start&lt;/label&gt;
  &lt;form:input path="startTime" name="startTime" placeholder="Start" /
  ...
  </code></pre>
  
  <p>...but I'm getting <code>Bad Request</code> errors.</p>
  
  <p>I know what that means, I just need to know a reliable way to fix it. How can I reliably accept time input in a Spring form?</p>
  
  <p><hr>
  Additional Network info:</p>
  
  <pre><code>Remote Address:[::1]:8080
  Request URL:http://localhost:8080/shift_create/1.html
  Request Method:POST
  Status Code:400 Bad Request
  Response Headers
  view source
  Cache-Control:must-revalidate,no-cache,no-store
  Content-Length:307
  Content-Type:text/html; charset=ISO-8859-1
  Date:Mon, 10 Aug 2015 08:37:27 GMT
  Server:Jetty(9.2.8.v20150217)
  Request Headers
  view source
  Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
  Accept-Encoding:gzip, deflate
  Accept-Language:en-US,en;q=0.8
  Cache-Control:max-age=0
  Connection:keep-alive
  Content-Length:58
  Content-Type:application/x-www-form-urlencoded
  Cookie:JSESSIONID=1w0rkel0w4eha96edvwq7rz1m
  Host:localhost:8080
  Origin:http://localhost:8080
  Referer:http://localhost:8080/profile.html
  Upgrade-Insecure-Requests:1
  User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.130 Safari/537.36
  Form Data
  view source
  view URL encoded
  name:ThisOne
  shiftDate:08/13/2015
  startTime:10:10 PM
  
  Form data source : name=ThisOne&amp;shiftDate=08%2F13%2F2015&amp;startTime=10%3A10+PM
  </code></pre>