Java XML Date Create dateToXmlDate(Date date)

Here you can find the source of dateToXmlDate(Date date)

Description

date To Xml Date

License

Apache License

Declaration

public static XMLGregorianCalendar dateToXmlDate(Date date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Date;
import java.util.GregorianCalendar;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;

public class Main {

    public static XMLGregorianCalendar dateToXmlDate(Date date) {
        GregorianCalendar cal = new GregorianCalendar();
        cal.setTime(date);/*from ww  w  .  j  a va2s .  c  o  m*/
        XMLGregorianCalendar gc = null;
        try {
            gc = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return gc;
    }
}

Related

  1. createXMLGregorianCalendar(final Date date)
  2. createXMLGregorianCalendar(final Date time)
  3. dateToString(Calendar calendar)
  4. dateToXml(Date date)
  5. DateToXmlCalendar(Date date)
  6. dateToXMLGC(Date fecha)
  7. dateToXmlGregorian(Date timestamp)
  8. dateToXmlGregorianCalendar(Calendar date)
  9. dateToXmlGregorianCalendar(Date d)