Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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);
    }
}