How to convert XMLGregorianCalendar to Date to XMLGregorianCalendar in Java - Example Tutorial

There are several ways to convert XMLGregorianCalendar to Date in Java. You can convert XMLGregorianCalendar to either java.util.Date or java.sql.Date based upon your need. JAXB (Java API/Architecture for XML Bindings) is a popular framework to create XML documents from Java Objects and Java objects from XML files. JAXB also helps to create Java classes from XML Schema file (.XSD file). By default JAXB maps XSD data type xs:date, xs:time and xs:dateTime to XMLGregorianCalendar in Java, but you can configure XJC to create java.util.Date objects instead of javax.xml.datatype.XMLGregorianCalendar. Since java.util.Dateis most popular way of dealing with date and time in Java, we often need to convert XMLGregorianCalendar instance to Date instance in Java. Thankfully by using Java API, we can easily do this conversion of XMLGregorianCalendar to Date and Date to XMLGregorianCalendar in Java. By the way, It's good to remember that XML Schema has three different types which can represent either date, time or both, while java.util.Date contains date and time information together. In this Java and XML tutorial, we will see example of converting XMLGregorianCalendar to Date and inverse in Java.
Read more �

Komentar

Postingan populer dari blog ini

Cara Membuat Halaman Login Hotspot Berbeda pada 1 Mikrotik

UltraISO Premium Edition v9.5.3

Arti OSAKMJ