Java tutorial
//package com.java2s; //License from project: Open Source License import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.datatype.DatatypeFactory; public class Main { /** * Parse an XML Date Time into an XMLGregorianCalendar. * * @param toParse * the xml date time string to parse. * @return the parsed XMLGregorianCalendar object. */ public static XMLGregorianCalendar getXMLGregorianCalendar(final String toParse) { try { return DatatypeFactory.newInstance().newXMLGregorianCalendar(toParse); } catch (Exception e) { return null; } } }