try {
GregorianCalendar gregCal = new GregorianCalendar();
gregCal.setTime(date);
return DatatypeFactory.newInstance().newXMLGregorianCalendar(gregCal);
} catch (DatatypeConfigurationException e) {
throw new DataDecodeException("Error decoding XMLGregorianCalendar data value '" + data + "' with decode format '" + format + "'.", e);
}
}