Java XML Date Create dateToXMLGregorianCalendar(Date date)

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

Description

date To XML Gregorian Calendar

License

Apache License

Declaration

public static XMLGregorianCalendar dateToXMLGregorianCalendar(Date date) throws DatatypeConfigurationException 

Method Source Code


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

import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;

import java.util.*;

public class Main {

    public static XMLGregorianCalendar dateToXMLGregorianCalendar(Date date) throws DatatypeConfigurationException {
        if (date == null)
            return null;
        return DatatypeFactory.newInstance().newXMLGregorianCalendar(dateToGregorianCalendar(date));
    }//from  ww  w  .  j av a2 s.  c  o  m

    public static GregorianCalendar dateToGregorianCalendar(Date date) {
        if (date == null)
            return null;
        GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT+09:00"), Locale.KOREAN);
        cal.setTime(date);
        return cal;
    }
}

Related

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