title: Spring REST LocalDate UTC differs of one day
body: <p>I'm using Spring Boot 1.5.4, Hibernate 5.2.10, Spring Data REST, HATEOAS, JDK8 with LocalDate and LocalDateTime.
  My computer is on CEST timezone but I want the application works in UTC, so I set in application.properties:</p>
  
  <pre><code>spring.datasource.url=jdbc:mysql://localhost:3306/database?useLegacyDatetimeCode=false&amp;serverTimezone=UTC&amp;useSSL=true
  spring.jpa.hibernate.jdbc.time_zone = UTC
  </code></pre>
  
  <p>According to this <a href="https://moelholm.com/2016/11/09/spring-boot-controlling-timezones-with-hibernate/" rel="nofollow noreferrer">article</a> I don't want to change the timezone of my JVM because seems not to be a best practice.</p>
  
  <p>Spring Data REST exposes my repositories and I use Swagger2 to have a nice interface to use API.
  When I try a endpoint I see something like:</p>
  
  <pre><code>    {
    "_embedded": {
      "dailyCodes": [
        {
          "sid": "d495cdaa-14f2-44cb-a98f-8aa6ddd43d91",
          "createdDate": "2017-06-28T16:20:01",
          "lastModifiedDate": "2017-06-28T16:20:01",
          "lastModifiedBy": "admin",
          "date": "2017-06-28",
          "code": "js",
          "new": false,
          "_links": {
            "self": {
              "href": "http://localhost:8080/api/v1/dailyCodes/1"
            },
            "dailyCode": {
              "href": "http://localhost:8080/api/v1/dailyCodes/1"
            }
          }
        }
  </code></pre>
  
  <p>Like you can see the datetime format is fine and also it display the CEST time even if in the db the real time is 14:20:01.
  I guess this is wrong because my REST API should work in UTC.</p>
  
  <p>How could I achieve this result?</p>
  
  <p>Always on the same topic, I've a REST endpoint (exposed by Spring Data REST) to search using LocalDate params; I'm using</p>
  
  <pre><code>@Transactional
  @PreAuthorize("isAuthenticated()")
  public interface DailyCodeRepository extends PagingAndSortingRepository&lt;DailyCode, Long&gt; {
  
  @Query("SELECT d FROM DailyCode d WHERE (:code IS NULL or code=:code) AND (:from IS NULL OR date&gt;=:from) AND (:to IS NULL OR date&lt;=:to)")
      public Page&lt;DailyCode&gt; findAllWithParameter(@Param("code") @RequestParam(value = "code", required = false) String code,
              @Param("from") @RequestParam(value = "from", required = false) LocalDate from,
              @Param("to") @RequestParam(value = "to", required = false) LocalDate to, Pageable pageable);
  }
  </code></pre>
  
  <p>Also in this case I've a strange thing: if I call the endpoint passing parameters, in the server they arrive with 1 day less. Furthemore the  date pattern accepted seems to be the JDK default of my locale (Italian) but I guess it's not a best practice.</p>
  
  <p>Is there a best practice to follow to avoid any problems with date/time arguments in both direction?</p>