javax.xml.datatype
import java.util.Date;
import javax.xml.datatype.*;
public class Example {
public static void main(String[] args) throws Exception {
Date date = new Date();
XMLGregorianCalendar xmlDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(date);
System.out.println(xmlDate); // Prints "2023-03-08T18:02:51.669-05:00"
}
}import javax.xml.datatype.*;
public class Example {
public static void main(String[] args) throws Exception {
XMLGregorianCalendar xmlDate = DatatypeFactory.newInstance().newXMLGregorianCalendar("2023-03-08T18:02:51.669-05:00");
System.out.println(xmlDate); // Prints "2023-03-08T18:02:51.669-05:00"
}
}