what is the best way to set a XMLGregorianCalendar value from a Calendar date?
posting.setXMLGregorianCalendar(message.getCreateDate());
here my class:
Message.java
private Calendar createDate;
public Calendar getCreateDate() {
return createDate;
}
You can try out this:
Calendar createDate = Calendar.getInstance();
Date cDate = createDate.getTime();
GregorianCalendar c = new GregorianCalendar();
c.setTime(cDate);
XMLGregorianCalendar date2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);