Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

LocalDateTime to XMLGregorianCalendar


LocalDateTime currentUTCTime = LocalDateTime.now(); // using system timezone
String iso = currentUTCTime.toString();
if (currentUTCTime.getSecond() == 0 && currentUTCTime.getNano() == 0) {
    iso += ":00"; // necessary hack because the second part is not optional in XML
}
XMLGregorianCalendar xml =
  DatatypeFactory.newInstance().newXMLGregorianCalendar(iso‌​);

Source by coders911.org #
 
PREVIOUS NEXT
Tagged: #LocalDateTime #XMLGregorianCalendar
ADD COMMENT
Topic
Name
2+8 =