List of utility methods to do XML Date Create
XMLGregorianCalendar | createXMLGregorianCalendar(Date currentDateTime) create XML Gregorian Calendar GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(currentDateTime); XMLGregorianCalendar createDate; try { createDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar); createDate.setMillisecond(DatatypeConstants.FIELD_UNDEFINED); createDate.setTimezone(DatatypeConstants.FIELD_UNDEFINED); } catch (DatatypeConfigurationException e) { ... |
XMLGregorianCalendar | createXmlGregorianCalendar(Date date) Converts the data to an XMLGregorianCalendar in the GMT time zone. if (date == null) { return null; GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); calendar.setTimeZone(TimeZone.getTimeZone("GMT")); return getDatatypeFactory().newXMLGregorianCalendar(calendar); |
XMLGregorianCalendar | createXMLGregorianCalendar(final Date date) Converts a given Date to a new XMLGregorianCalendar . if (date == null) { return null; final GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); try { XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory.newInstance() .newXMLGregorianCalendar(calendar); ... |
XMLGregorianCalendar | createXMLGregorianCalendar(final Date time) create XML Gregorian Calendar GregorianCalendar c = new GregorianCalendar(TimeZone.getTimeZone("UTC")); c.setTime(time); return DatatypeFactory.newInstance().newXMLGregorianCalendar(c); |
String | dateToString(Calendar calendar) Formats the given date into its string representation according to the ISO 8601 (e.g. GregorianCalendar utcCalendar = new GregorianCalendar(TimeZone.getTimeZone("UTC")); utcCalendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DATE)); XMLGregorianCalendar xmlCalendar = dtFactory.newXMLGregorianCalendar(utcCalendar); xmlCalendar = xmlCalendar.normalize(); return xmlCalendar.toXMLFormat(); |
XMLGregorianCalendar | dateToXml(Date date) date To Xml Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
XMLGregorianCalendar sdate = null;
try {
sdate = DatatypeFactory.newInstance().newXMLGregorianCalendar();
sdate.setYear(calendar.get(Calendar.YEAR));
sdate.setMonth(calendar.get(Calendar.MONTH) + 1);
sdate.setDay(calendar.get(Calendar.DAY_OF_MONTH));
...
|
XMLGregorianCalendar | DateToXmlCalendar(Date date) Date To Xml Calendar GregorianCalendar calendar; calendar = new GregorianCalendar(getDefaultTimeZone()); calendar.setTime(date); try { DatatypeFactory factory = DatatypeFactory.newInstance(); return factory.newXMLGregorianCalendar(calendar); } catch (DatatypeConfigurationException e) { return null; ... |
XMLGregorianCalendar | dateToXmlDate(Date date) date To Xml Date GregorianCalendar cal = new GregorianCalendar(); cal.setTime(date); XMLGregorianCalendar gc = null; try { gc = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal); } catch (Exception e) { e.printStackTrace(); return gc; |
XMLGregorianCalendar | dateToXMLGC(Date fecha) metodo que convierte de date a xmlGregorianCalendar XMLGregorianCalendar dateResult = null; if (fecha == null) { dateResult = null; } else { try { GregorianCalendar c = new GregorianCalendar(); c.setTime(fecha); dateResult = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); ... |
XMLGregorianCalendar | dateToXmlGregorian(Date timestamp) date To Xml Gregorian GregorianCalendar cal = new GregorianCalendar(); cal.setTime(timestamp); XMLGregorianCalendar xmlCalendar = null; xmlCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal); return xmlCalendar; |