List of utility methods to do XML Date Create
XMLGregorianCalendar | dateToXmlGregorianCalendar(Calendar date) date To Xml Gregorian Calendar GregorianCalendar c = new GregorianCalendar(); c.setTime(date.getTime()); try { return DatatypeFactory.newInstance().newXMLGregorianCalendar(c); } catch (DatatypeConfigurationException e) { return null; |
XMLGregorianCalendar | dateToXmlGregorianCalendar(Date d) date To Xml Gregorian Calendar if (d == null) { return null; GregorianCalendar gregory = new GregorianCalendar(); gregory.setTime(d); XMLGregorianCalendar returnValue; returnValue = datatypeFactory.newXMLGregorianCalendar(gregory); return returnValue; ... |
XMLGregorianCalendar | dateToXMLGregorianCalendar(Date date) date To XML Gregorian Calendar if (date == null) { return null; GregorianCalendar gCalendar = new GregorianCalendar(); gCalendar.setTime(date); return DatatypeFactory.newInstance().newXMLGregorianCalendar(gCalendar); |
XMLGregorianCalendar | dateToXMLGregorianCalendar(Date date) date To XML Gregorian Calendar if (date == null) return null; return DatatypeFactory.newInstance().newXMLGregorianCalendar(dateToGregorianCalendar(date)); |
XMLGregorianCalendar | getXMLCalendar(String xsdDateTimeStr) get XML Calendar return getDatatypeFactory().newXMLGregorianCalendar(xsdDateTimeStr);
|
XMLGregorianCalendar | getXMLCurrentTime() get XML Current Time GregorianCalendar gcal = new GregorianCalendar(); XMLGregorianCalendar xcal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal); return xcal; |
XMLGregorianCalendar | getXMLDate() get XML Date GregorianCalendar cal = new GregorianCalendar(); XMLGregorianCalendar sample; XMLGregorianCalendar result; try { sample = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal); result = DatatypeFactory.newInstance().newXMLGregorianCalendar(); result.clear(); result.setMonth(sample.getMonth()); ... |
XMLGregorianCalendar | getXMLDate(Date date) Gets the XML Gregorian calendar from date. DatatypeFactory dataTypeFactory; try { dataTypeFactory = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException e) { throw new RuntimeException(e); GregorianCalendar gc = new GregorianCalendar(); gc.setTimeInMillis(date.getTime()); ... |
XMLGregorianCalendar | getXMLDate(Date dateTime) e.g. DatatypeFactory f = null; try { f = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException e) { throw new RuntimeException("convert to runtime exception", e); GregorianCalendar cal = new GregorianCalendar(); cal.setTimeZone(TimeZone.getTimeZone("GMT")); ... |
XMLGregorianCalendar | getXMLDate(final Calendar calendar) get XML Date GregorianCalendar c; if (calendar instanceof GregorianCalendar) { c = (GregorianCalendar) calendar; } else { c = new GregorianCalendar(); c.setTimeZone(UTC); c.setTime(calendar.getTime()); try { XMLGregorianCalendar ret = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); ret.setMillisecond(DatatypeConstants.FIELD_UNDEFINED); return ret; } catch (DatatypeConfigurationException e) { return null; |