Code example for DatatypeFactory

Methods: newXMLGregorianCalendar

        if (date == null) {
            return null; 
        } else { 
            GregorianCalendar gc = new GregorianCalendar();
            return df.newXMLGregorianCalendar(gc);
     * Converts an XMLGregorianCalendar to an instance of java.util.Date 
     * @param xgc Instance of XMLGregorianCalendar or a null reference 
     * @return java.util.Date instance whose value is based upon the 
     *  value in the xgc parameter. If the xgc parameter is null then 
     *  this method will simply return null. 
    public static java.util.Date asDate(XMLGregorianCalendar xgc) {
        if (xgc == null) {
            return null; 
Connect your IDE to all the code out there  Get Codota for Java