Code example for DatatypeFactory

Methods: newXMLGregorianCalendar

0
        if (date == null) {
            return null; 
        } else { 
            GregorianCalendar gc = new GregorianCalendar();
            gc.setTimeInMillis(date.getTime());
            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; 
        } else {