Here you can find the source of xmlToDateTime(final XMLGregorianCalendar xmlCal)
public static DateTime xmlToDateTime(final XMLGregorianCalendar xmlCal)
//package com.java2s; //License from project: Open Source License import javax.xml.datatype.XMLGregorianCalendar; import org.joda.time.DateTime; public class Main { public static DateTime xmlToDateTime(final XMLGregorianCalendar xmlCal) { DateTime result = null;//from w w w. jav a 2 s .c om if (xmlCal != null) { int hourOfDay = xmlCal.getHour(); int minuteOfHour = xmlCal.getMinute(); int secondOfMinute = xmlCal.getSecond(); int milliOfSecond = xmlCal.getMillisecond(); if (hourOfDay < 0) { hourOfDay = 0; } if (minuteOfHour < 0) { minuteOfHour = 0; } if (secondOfMinute < 0) { secondOfMinute = 0; } if (milliOfSecond < 0) { milliOfSecond = 0; } result = new DateTime(xmlCal.getYear(), xmlCal.getMonth(), xmlCal.getDay(), hourOfDay, minuteOfHour, secondOfMinute, milliOfSecond); } return result; } }