title: Date to XMLGregorianCalendar with specific format
body: <p>I am getting a Date object, which i need to convert to XMLGregorian Calendar specific format</p>
  
  <p>I tried below ways</p>
  
  <pre><code>String formattedDate = sdf.format(categoryData.getBulkCollectionTime()); //yyyy-MM-dd HH:mm:ss
  XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(formattedDate);
  dataListType.setTimestamp(xmlCal);
  </code></pre>
  
  <p>I am getting an exception, for sure I am doing wrong here. But I want to format the Date object into specified format, which is done by sdf.format perfectly.</p>
  
  <p>But how do I create the XMLGregorianCalendar object for the same (from formattedDate)?</p>