title: Gson can't parse my json date in java
body: <p>I'm trying to make some test for a java-ee application that uses rest, but when I tried to format some json with gson I got the following error:</p>
  
  <p><code>java.text.ParseException: Failed to parse date ["1489752692000']: Invalid time zone indicator '9'</code></p>
  
  <p>This happened when I initialized my Gson with <code>Gson gson = new Gson();</code>, I found <a href="https://stackoverflow.com/questions/25455123/gson-fails-to-parse-using-gsonbuilder-setdateformatyyyy-mm-ddthhmmss-sssz">this question</a> on StackOverflow where the solution was to make a custom DateDeseriliazer class and intialize like this:</p>
  
  <pre><code>Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new GsonDateFormatter()).create();
  </code></pre>
  
  <p>Here is my version of the DateDeserializer class:</p>
  
  <pre><code>public class GsonDateFormatter implements JsonDeserializer&lt;Date&gt; {
  
      private final DateFormat dateFormat;
  
      public GsonDateFormatter() {
          dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
          dateFormat.setTimeZone(TimeZone.getTimeZone("CET"));
      }
  
      public synchronized Date deserialize(JsonElement jsonElement,Type type,JsonDeserializationContext jsonDeserializationContext) {
          try {
              return dateFormat.parse(jsonElement.getAsString());
          } catch (ParseException e) {
              throw new JsonParseException(e);
          }
      }
  }
  </code></pre>
  
  <p>But this only changes the error message to:</p>
  
  <p><code>java.text.ParseException: Unparseable date: "1489752692000"</code></p>
  
  <p>So I'm not quite sure how to solve this now and I hope someone can help me with this.</p>
  
  <p>Thanks in advance.</p>