Here you can find the source of toXmlDate(GregorianCalendar date)
public static XMLGregorianCalendar toXmlDate(GregorianCalendar date)
//package com.java2s; //License from project: Open Source License import java.util.Date; import java.util.GregorianCalendar; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; public class Main { public static XMLGregorianCalendar toXmlDate(GregorianCalendar date) { try {/*from w ww . j a va2 s . co m*/ return DatatypeFactory.newInstance().newXMLGregorianCalendar(date); } catch (DatatypeConfigurationException dtce) { throw new UnsupportedOperationException("Nemohu prevest " + "GregorianCalendar na XMLGregorianCalendar", dtce); } } public static XMLGregorianCalendar toXmlDate(Date date) { try { GregorianCalendar c = new GregorianCalendar(); c.setTime(date); return DatatypeFactory.newInstance().newXMLGregorianCalendar(c); } catch (DatatypeConfigurationException dtce) { throw new UnsupportedOperationException("Nemohu prevest " + "GregorianCalendar na XMLGregorianCalendar", dtce); } } }