title: How to generate XMLGregorianCalendar time as UTC
body: <p>I want to create an <code>XMLGregorianCalendar</code> with the following characteristics:</p>
  
  <ul>
  <li>Time only</li>
  <li>UTC timezone (The "Z" appended at the end)</li>
  </ul>
  
  <p>So I would expect the date to be printed as: <strong>18:00:00Z</strong> (<a href="https://www.w3schools.com/xml/schema_dtypes_date.asp" rel="noreferrer">XML Date</a>).</p>
  
  <p>The element is an xsd:time and I want the time to be displayed like this in the XML.</p>
  
  <pre><code>&lt;time&gt;18:00:00Z&lt;/time&gt;
  </code></pre>
  
  <p>But I am getting the following: <strong>21:00:00+0000</strong>. I am at -3 offset and the result is the calculation with my offset.</p>
  
  <p>Why is wrong with my code?</p>
  
  <pre><code>protected XMLGregorianCalendar timeUTC() throws Exception {
      Date date = new Date();
      DateFormat df = new SimpleDateFormat("HH:mm:ssZZ");
      df.setTimeZone(TimeZone.getTimeZone("UTC"));
      String dateS = df.format(date);
      return DatatypeFactory.newInstance().newXMLGregorianCalendar(dateS);
  }
  </code></pre>