Java tutorial
//package com.java2s; import java.util.GregorianCalendar; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; public class Main { public static XMLGregorianCalendar getXMLGregorianCalendarTimestamp() { try { DatatypeFactory dtf = DatatypeFactory.newInstance(); GregorianCalendar gc = new GregorianCalendar(); return dtf.newXMLGregorianCalendar(gc); } catch (DatatypeConfigurationException e) { e.printStackTrace(); return null; } } }