List of utility methods to do XML Date
String | getXSDDateTimeFromCalendar(Calendar calTime) Take a Calendar object and return an xsd:dateTime format string. String ret = null; try { ret = DatatypeConverter.printDateTime(calTime); } catch (Exception e) { e.printStackTrace(); return ret; |
boolean | isPreEIDAS(Date date) is Pre EIDAS return date != null && date.compareTo(EIDAS_DATE) < 0;
|
boolean | isValidDateUpdatedType(Calendar value) is Valid Date Updated Type final Calendar min = DatatypeConverter.parseDateTime("2000-12-31T00:00:00"); return value != null && !value.before(min); |
String | printDate(final Calendar date) print Date date.setTimeZone(TimeZone.getTimeZone("UTC")); return DatatypeConverter.printDateTime(date); |
String | printDate(java.util.Date dt) print Date if (dt == null) { return null; Calendar c = Calendar.getInstance(); c.setTime(dt); return DatatypeConverter.printDate(c); |
String | printDateTime(final Date date) Formats a date value in a string, assuming UTC timezone and Canada locale. if (date == null) { return null; final Calendar calendar = CALENDAR.get(); calendar.setTime(date); return DatatypeConverter.printDateTime(calendar); |
String | printDateUpdatedType(Calendar value) print Date Updated Type if (value == null || !isValidDateUpdatedType(value)) throw new IllegalArgumentException("Can't print date-updated value!"); else return DatatypeConverter.printDateTime(value); |
long | string2millis(String lexicalXSDDateTime) Converts given string to milliseconds from Unix Epoch long res; try { res = javax.xml.bind.DatatypeConverter.parseDateTime(lexicalXSDDateTime).getTimeInMillis(); } catch (IllegalArgumentException e) { return -1; return res; |
Date | toDate(String date) to Date Calendar cal = DatatypeConverter.parseDateTime(date);
cal.setTimeZone(TimeZone.getTimeZone(TIMEZONE));
return cal.getTime();
|
Date | toJavaDate(String dateStr) Converts a date string in [datetime] format to a java date if (!DATE_PATTERN.matcher(dateStr).matches()) { return null; try { return DatatypeConverter.parseDateTime(dateStr).getTime(); } catch (IllegalArgumentException e) { return null; |