Java Date Time to String dateTimeToXSDate(Date date)

Here you can find the source of dateTimeToXSDate(Date date)

Description

Convert DateTime to XML Schema date.

License

Open Source License

Parameter

Parameter Description
date the date

Return

String representation of DateTime.

Declaration

static String dateTimeToXSDate(Date date) 

Method Source Code

//package com.java2s;

import java.text.DateFormat;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    /**//  w ww .j  a va  2 s . c om
     * Convert DateTime to XML Schema date.
     * 
     * @param date
     *            the date
     * @return String representation of DateTime.
     */
    static String dateTimeToXSDate(Date date) {
        String format = "yyyy-MM-dd'Z'";
        DateFormat utcFormatter = new SimpleDateFormat(format);
        return utcFormatter.format(date);
    }
}

Related

  1. dateTimeToString(Date date, String formatter)
  2. dateTimeToString(final Date date)
  3. dateTimeToString(final Date date)
  4. dateTimeToString_mmddyyyy(Date d)
  5. dateTimeToXSDate(Date date)