Java XML Date Create dateToXmlGregorianCalendar(Calendar date)

Here you can find the source of dateToXmlGregorianCalendar(Calendar date)

Description

date To Xml Gregorian Calendar

License

Open Source License

Declaration

static XMLGregorianCalendar dateToXmlGregorianCalendar(Calendar date) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;
import java.util.GregorianCalendar;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;

public class Main {
    static XMLGregorianCalendar dateToXmlGregorianCalendar(Calendar date) {
        GregorianCalendar c = new GregorianCalendar();
        c.setTime(date.getTime());//from w  ww .  ja  v  a 2s .c  o  m
        try {
            return DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
        } catch (DatatypeConfigurationException e) {
            // Will never happen -- ignore
            return null;
        }
    }
}

Related

  1. dateToXml(Date date)
  2. DateToXmlCalendar(Date date)
  3. dateToXmlDate(Date date)
  4. dateToXMLGC(Date fecha)
  5. dateToXmlGregorian(Date timestamp)
  6. dateToXmlGregorianCalendar(Date d)
  7. dateToXMLGregorianCalendar(Date date)
  8. dateToXMLGregorianCalendar(Date date)
  9. getXMLCalendar(String xsdDateTimeStr)