Convert Date to XMLGregorianCalendar


GregorianCalendar gregorianCalendar = new GregorianCalendar();
gregorianCalendar.setTime(new Date(System.currentTimeMillis()));
XMLGregorianCalendar xmlGrogerianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar);

Convert XMLGregorianCalendar to Date


Date date = xmlGrogerianCalendar.toGregorianCalendar().getTime();

Hope this post help you.😉

For info about my newest post :