Java XML Date Create xmlGregorianCalendar()

Here you can find the source of xmlGregorianCalendar()

Description

xml Gregorian Calendar

License

Open Source License

Declaration

public static XMLGregorianCalendar xmlGregorianCalendar() throws DatatypeConfigurationException 

Method Source Code

//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 xmlGregorianCalendar() throws DatatypeConfigurationException {
        GregorianCalendar cal = new GregorianCalendar();
        return DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
    }// w  w  w  . jav a 2s .  c  o m

    public static XMLGregorianCalendar xmlGregorianCalendar(Date date) throws DatatypeConfigurationException {
        GregorianCalendar cal = new GregorianCalendar();
        cal.setTime(date);
        return DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
    }
}

Related

  1. xmlCalendarToCalendar(XMLGregorianCalendar xmlCalendar)
  2. xmlDateToDate(XMLGregorianCalendar xmlCalendar)
  3. xmlDateToLong(String s)
  4. xmlGCtoMillis(XMLGregorianCalendar gc)
  5. xmlGregorian2Gregorian(XMLGregorianCalendar xmlGC)
  6. xmlGregorianCalendarToDate(XMLGregorianCalendar cal)
  7. xmlGregorianCalendarToDate(XMLGregorianCalendar calendar)
  8. XMLGregorianCalendarToDate(XMLGregorianCalendar gc)
  9. xmlGregorianCalendarToTimestamp(XMLGregorianCalendar xgc)