code: private XMLGregorianCalendar toXMLGregorianCalendar(final DateTime date) {
          GregorianCalendar gCalendar = new GregorianCalendar(date.getZone().toTimeZone());
          gCalendar.setTime(date.toDate());
          XMLGregorianCalendar xmlGrogerianCalendar = null;
          try {
              xmlGrogerianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gCalendar);
  
          } catch (DatatypeConfigurationException ex) {
              log.error(ex.getMessage());
              System.out.println(ex.getStackTrace());
          }
          return xmlGrogerianCalendar;
      }
docs: Converts java.util.Date to javax.xml.datatype.XMLGregorianCalendar.
  
  @param date
  Date parameter.
  @return a XMLGregorianCalendar for date.