title: Java Date to UTC using gson
body: <p>I can't seem to get gson to convert a Date to UTC time in java....
  Here is my code...</p>
  
  <pre><code>Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").create();
  //This is the format I want, which according to the ISO8601 standard - Z specifies UTC - 'Zulu' time
  
  Date now=new Date();          
  System.out.println(now);       
  System.out.println(now.getTimezoneOffset());
  System.out.println(gson.toJson(now));
  </code></pre>
  
  <p>Here is my Output</p>
  
  <pre><code>Thu Sep 25 18:21:42 BST 2014           // Time now - in British Summer Time 
  -60                                    // As expected : offset is 1hour from UTC    
  "2014-09-25T18:21:42.026Z"             // Uhhhh this is not UTC ??? Its still BST !!
  </code></pre>
  
  <p>The gson result I want and what I was expecting</p>
  
  <pre><code>"2014-09-25T17:21:42.026Z"
  </code></pre>
  
  <p>I can clearly just subtract 1hr before the call toJson but this seems to be a hack. How can I configure gson to always convert to UTC ?</p>