Java Utililty Methods XML Date to

List of utility methods to do XML Date to

Description

The list of methods to do XML Date to are organized into topic(s).

Method

DateconvertXMLGregorianCalendarToDate(final XMLGregorianCalendar calendar)
Convert the XMLGregorianCalendar into a Date .
if (null == calendar) {
    throw new IllegalArgumentException("cannot convert null date/time");
return calendar.toGregorianCalendar().getTime();
DateconvertXMLGregorianCalendarToDate(XMLGregorianCalendar xmlGregorianCalendar)
convert XML Gregorian Calendar To Date
return xmlGregorianCalendar.toGregorianCalendar().getTime();
DateconvertXMLGregorianCalendarToDate(XMLGregorianCalendar xmlGregorianCalendar)
method to convert from Date to XMLGregorianCalendar
return xmlGregorianCalendar == null ? null : xmlGregorianCalendar.toGregorianCalendar().getTime();
StringConvertXMLGregorianCalenderToString(XMLGregorianCalendar Calendar, String Format)
Convert XML Gregorian Calender To String
if (Calendar == null)
    return "";
SimpleDateFormat sdf = new SimpleDateFormat(Format);
GregorianCalendar gregorianCalendar = Calendar.toGregorianCalendar();
return sdf.format(gregorianCalendar.getTime());
DategetDate(XMLGregorianCalendar calendar)
get Date
if (calendar == null) {
    return null;
return calendar.toGregorianCalendar().getTime();
DategetDate(XMLGregorianCalendar calendar)
Gets the date from the XML Gregorian calendar.
Date result = calendar.toGregorianCalendar().getTime();
return result;
longGetDateDiffInDays(XMLGregorianCalendar Calendar)
Get Date Diff In Days
if (Calendar == null)
    return -1;
Date d1 = Calendar.toGregorianCalendar().getTime();
Date today = new Date();
if (today.after(d1))
    return -1;
long diff = d1.getTime() - today.getTime();
return (diff / (1000 * 60 * 60 * 24)) + 1;
...
DategetDateFromXmlGregorianCalendar(XMLGregorianCalendar da)
get Date From Xml Gregorian Calendar
if (da != null) {
    int year = da.getYear();
    int month = da.getMonth();
    int day = da.getDay();
    int hour = da.getHour();
    int minute = da.getMinute();
    int second = da.getSecond();
    Calendar calendar = Calendar.getInstance();
...
DategetDateFromXMLGregorianCalendar(XMLGregorianCalendar xmlCalendar)
Converts a Date into a XMLGregorianCalendar
Date retObj = null;
if (xmlCalendar != null) {
    retObj = xmlCalendar.toGregorianCalendar().getTime();
return retObj;
DategetDateFromXMLGregorianCalendar(XMLGregorianCalendar xmlGregorianCalendar)
get Date From XML Gregorian Calendar
return xmlGregorianCalendar.toGregorianCalendar().getTime();