title: How do you specify the date format used when JAXB marshals xsd:dateTime?
body: <p>When JAXB marshals a date object (<code>XMLGregorianCalendar</code>) into an xsd:dateTime element. How can you specify the format of the resulting XML?</p>
  
  <p>For example:
  The default data format uses milliseconds <code>&lt;StartDate&gt;2012-08-21T13:21:58.000Z&lt;/StartDate&gt;</code>
  I need to omit the milliseconds.  <code>&lt;StartDate&gt;2012-08-21T13:21:58Z&lt;/StartDate&gt;</code></p>
  
  <p>How can I specify the output form/date format that I want it to use?
  I'm using <code>javax.xml.datatype.DatatypeFactory</code> to create the <code>XMLGregorianCalendar</code> object.</p>
  
  <pre><code>XMLGregorianCalendar xmlCal = datatypeFactory.newXMLGregorianCalendar(cal);
  </code></pre>