title: Truncating java.util.Date to LocalDate *without* toInstant() because java.sql.Date gives UnsupportedOperationException
body: <p>If I use <code>java.util.Date</code>'s <code>toInstant()</code> on a variable which happens to be a <code>java.sql.Date</code>, I get an <code>UnsupportedOperationException</code>. </p>
  
  <pre><code>try {
      java.util.Date input = new java.sql.Date(System.currentTimeMillis());
      LocalDate date = input.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
  } catch (UnsupportedOperationException e) {
      // grrr!
  }
  </code></pre>
  
  <p>The <code>java.util.Date</code> that I'm concerned with comes from a DATE field in a mysql DB via a legacy API, and is actually a <code>java.sql.Date</code>. </p>
  
  <p>Now the following related questions are all very interesting:</p>
  
  <p><a href="https://stackoverflow.com/questions/36435492/unsupportedoperationexception-why-cant-you-call-toinstant-on-a-java-sql-dat">UnsupportedOperationException - Why can&#39;t you call toInstant() on a java.sql.Date?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/21242110/convert-java-util-date-to-java-time-localdate">Convert java.util.Date to java.time.LocalDate</a></p>
  
  <p><a href="https://stackoverflow.com/questions/33066904/localdate-to-java-util-date-and-vice-versa-simplest-conversion">LocalDate to java.util.Date and vice versa simplest conversion?</a></p>
  
  <p>but they don't provide any elegant way of truncating a <code>java.util.Date</code> to get rid of the time component and get a Java 8 <code>LocalDate</code>.</p>
  
  <p>I admit there is an issue that the same instant in time in one timezone might be a different date from the same instant in another timezone. </p>
  
  <p>I suspect the solution will involve java.util.Calendar but rather than craft my own solution I'd rather establish what others have done first. </p>
  
  <p>I'd prefer to find something shorter than this:</p>
  
  <blockquote>
    <p>from <a href="https://stackoverflow.com/questions/227007/resetting-the-time-part-of-a-timestamp-in-java">Resetting the time part of a timestamp in Java</a> :</p>
  
  <pre><code>Date date = new Date();                      // timestamp now
  Calendar cal = Calendar.getInstance();       // get calendar instance
  cal.setTime(date);                           // set cal to date
  cal.set(Calendar.HOUR_OF_DAY, 0);            // set hour to midnight
  cal.set(Calendar.MINUTE, 0);                 // set minute in hour
  cal.set(Calendar.SECOND, 0);                 // set second in minute
  cal.set(Calendar.MILLISECOND, 0);            // set millis in second
  Date zeroedDate = cal.getTime();             // actually computes the new Date
  </code></pre>
  </blockquote>