Java Date to String dateToW3c(Date d)

Here you can find the source of dateToW3c(Date d)

Description

Convert a Date to a W3C String.

License

Open Source License

Parameter

Parameter Description
d the Date

Return

the String

Declaration

public static String dateToW3c(Date d) 

Method Source Code

//package com.java2s;
// compliance with the InfoGrid license. The InfoGrid license and important

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

public class Main {
    /**/*w ww  .j  a  va2s . c  o  m*/
     * Date format to use for W3C.
     */
    public static final SimpleDateFormat theW3cFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");

    /**
     * Convert a Date to a W3C String.
     *
     * @param d the Date
     * @return the String
     */
    public static String dateToW3c(Date d) {
        String ret = theW3cFormat.format(d);

        return ret;
    }
}

Related

  1. dateToStringWithPattern(Date date, String pattern)
  2. dateToStringWithTime(Date date)
  3. dateToTimeString(Date date)
  4. dateToUTCDate(Date d)
  5. dateToUtcString(Date date)
  6. dateToW3CDTF(Date date)
  7. dateToW3CDTF(Date date)
  8. dateToyyyyMMddHHmmss(Date date)