Java XML Date Create getXMLFormat(Calendar calendar)

Here you can find the source of getXMLFormat(Calendar calendar)

Description

get XML Format

License

Open Source License

Declaration

private static String getXMLFormat(Calendar calendar)
            throws DatatypeConfigurationException 

Method Source Code

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

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

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Locale;

public class Main {
    private static String getXMLFormat(Calendar calendar)
            throws DatatypeConfigurationException {
        GregorianCalendar greg = new GregorianCalendar(Locale.US);
        greg.setTime(calendar.getTime());
        greg.setTimeZone(calendar.getTimeZone());
        XMLGregorianCalendar xmlCalendar = DatatypeFactory.newInstance()
                .newXMLGregorianCalendar(greg);
        return xmlCalendar.toXMLFormat();
    }/* w  ww. j a va  2  s . com*/
}

Related

  1. getXMLDate(Date dateTime)
  2. getXMLDate(final Calendar calendar)
  3. getXMLDateString()
  4. getXMLDateStringFromDouble(double d)
  5. getXMLDateTime(Date date)
  6. getXmlGregCal(Date dt)
  7. getXMLGregorianCalendar()
  8. getXMLGregorianCalendar(Date date)
  9. getXMLGregorianCalendar(Date date)