title: dates change between client and server side (GWT)
body: <p>I have a problem that I can't understand. I tried to find the answer a lot of time, but without success.</p>
  
  <p>I work with GWT client side, and Java server side.</p>
  
  <p>Client side, I read dates (java.util.date). And when I send these dates to server side, there sometimes is an hour offset when I receive it.
  I know there are many problems with TimeZone. But I think TimeZone aren't responsible of my problem, because not all dates are wrong. To test which dates were wrong, I create a method which create a List of all dates between 1st January of 1900 and today, and which send this list to the server.</p>
  
  <p>When I read the list received in server, here are the results :</p>
  
  <ul>
  <li>All dates are correct from the year 1995 (dates didn't change during sending)</li>
  <li>From 1979 to 1995 (approximately): All dates are correct, except 28 days in september / october (from the swith to winter daylight saving time). It's incorrect because of an offset of one hour.</li>
  <li>Before : some dates are correct, and some incorrect.</li>
  </ul>
  
  <p>So I tried to add 100 years to my dates client side, send it and remove 100 years server side. And all received dates were correct !</p>
  
  <p>Anybody already had this problem ? And anybody understood this problem ? Any help is welcome.</p>
  
  <p>Thanks !</p>
  
  <p>Edit :</p>
  
  <p>Ok I solved the problem. Read answer of Andrei Volgin to understand the problem. And here is the code which solved it :</p>
  
  <pre><code>// Create date you want
  Date date = new Date()
  
  // Get TimeZone of your date
  TimeZone timeZone = TimeZone.createTimeZone(date.getTimezoneOffset());
  
  // Adapt your date with the TimeZone
  date.setTime(date.getTime() - (timeZone.getOffset(date) * 60000));
  
  // You can send your date to server
  // TimeZone server side is "UTC", and all dates received are correct
  </code></pre>