Here you can find the source of getDateFromXmlGregorianCalendar(XMLGregorianCalendar da)
public static Date getDateFromXmlGregorianCalendar(XMLGregorianCalendar da)
//package com.java2s; //License from project: Apache License import javax.xml.datatype.XMLGregorianCalendar; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static Date getDateFromXmlGregorianCalendar(XMLGregorianCalendar da) { 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(); calendar.set(year, month - 1, day, hour, minute, second); Date date = calendar.getTime(); return date; } else {/*from w w w . j ava 2 s . co m*/ return null; } } public static String getDay() { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); return sdf.format(date); } }