xmlgregoriancalendar to localdatetime code example
Example: LocalDateTime to XMLGregorianCalendar
LocalDateTime localDatetime = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
String formattedDate = localDatetime.format(formatter);
XMLGregorianCalendar calendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(formattedDate);