How to use XMLGregorianCalendar

H

How to convert a Date to an XMLGregorianCalendar

GregorianCalendar c = new GregorianCalendar();
c.setTime(new Date());
XMLGregorianCalendar xmlDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);

How to convert an XMLGregorianCalendar to a Date

Date date = xmlDate.toGregorianCalendar().getTime();

1 comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Tag Cloud

Categories