Java tutorial
//package com.java2s; import java.util.Calendar; import java.util.Date; import javax.xml.bind.DatatypeConverter; public class Main { /** * Converts Date into XML-Tag with type xsd:dateTime */ public static String getXMLDate(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return DatatypeConverter.printDateTime(calendar); } }