Skip to main content


Showing posts with the label XMLGregorianCalendar

Convert LocalDateTime to XmlGregorianCalendar in Java [2021]

Convert LocalDateTime to  XMLGregorianCalendar   in Java [2021]  We can convert LocalDateTime to XMLGregorianCalendar in java  Using  DatatypeFactory.newInstance() .newXMLGregorianCalendar(gregorianCalendar) method which takes  GregorianCalendar instance as input parameter. Contents LocalDateTime XMLGregorianCalendar 1. Convert LocalDateTime to XMLGregorianCalendar Complete Example Conclusion References Here is a brief intro about LocalDateTime and  XMLGregorianCalendar class. LocalDateTime LocalDateTime is an instance of date-time without a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30. LocalDateTime is an immutable date-time object that represents a date-time, often viewed as a year-month-day-hour-minute-second. XMLGregorianCalendar It is a  Representation for W3C XML Schema 1.0 date/time datatypes. These datatypes are normatively defined in  W3C XML Schema 1.0 Part 2, Section 3.2.7-14 . The XML Schema standard defines clear rules for spe