SyntaxFix
Write A Post
Hire A Developer
Questions
A one line example using Joda-Time library:
XMLGregorianCalendar xgc = DatatypeFactory.newInstance().newXMLGregorianCalendar(new DateTime().toGregorianCalendar());
Credit to Nicolas Mommaerts from his comment in the accepted answer.