List of utility methods to do XML Date Create
XMLGregorianCalendar | getXMLGregorianCalendarFromDate(Date date) get XML Gregorian Calendar From Date GregorianCalendar gregorianCalendar = new GregorianCalendar(); gregorianCalendar.setTime(date); try { XMLGregorianCalendar xmlGrogerianCalendar = DatatypeFactory.newInstance() .newXMLGregorianCalendar(gregorianCalendar); return xmlGrogerianCalendar; } catch (DatatypeConfigurationException e) { throw new RuntimeException(e); ... |
XMLGregorianCalendar | getXMLGregorianCalendarFromDate(Date date) Converts a Date into a XMLGregorianCalendar XMLGregorianCalendar retObj = null; if (date != null) { GregorianCalendar gregCal = new GregorianCalendar(); gregCal.setTime(date); retObj = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregCal); return retObj; |
XMLGregorianCalendar | getXMLGregorianCalendarValue(Date date) Gets an instance of XMLGregorianCalendar class initialized per the specified java.util.Date value. GregorianCalendar gregorianCalendar = new GregorianCalendar(); if (date != null) { gregorianCalendar.setTime(date); try { return DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar); } catch (DatatypeConfigurationException ex) { throw new IllegalStateException("Failed to create a new instance of DataTypeFactory.", ex); ... |
XMLGregorianCalendar | getXMLGregorianCalenderDate() get XML Gregorian Calender Date GregorianCalendar c = new GregorianCalendar(); c.setTime(Calendar.getInstance().getTime()); return DatatypeFactory.newInstance().newXMLGregorianCalendar(c); |
Date | toDate(final XMLGregorianCalendar xml) Converts the given XML Gregorian calendar to a date. if (xml != null) { return xml.toGregorianCalendar().getTime(); return null; |
Date | toDate(long date) to Date return new Date(date); |
Date | toDate(XMLGregorianCalendar cal) Returns a Date date and time representation. if (cal != null) { final Calendar c = Calendar.getInstance(); c.set(Calendar.DATE, cal.getDay()); c.set(Calendar.MONTH, cal.getMonth() - 1); c.set(Calendar.YEAR, cal.getYear()); c.set(Calendar.DAY_OF_MONTH, cal.getDay()); c.set(Calendar.HOUR_OF_DAY, cal.getHour()); c.set(Calendar.MINUTE, cal.getMinute()); ... |
Date | toDate(XMLGregorianCalendar cal) Liefert ein Date-Objekt fuer den Kalender. if (cal == null) return null; return cal.toGregorianCalendar().getTime(); |
Date | toDate(XMLGregorianCalendar date) to Date return date.toGregorianCalendar().getTime();
|
Date | toDate(XMLGregorianCalendar dateTime) Convert an XML date/time to its java.util.Date equivalent.
return dateTime.toGregorianCalendar().getTime();
|