Java HTTP Date getHttpDateString(Date date)

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

Description

Formats a Date according to the HTTP specification standard date format.

License

Open Source License

Parameter

Parameter Description
date the Date to format.

Return

a formatted string.

Declaration

public static String getHttpDateString(Date date) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static final SimpleDateFormat HTTP_DATE_FORMAT = new SimpleDateFormat(
            "EEE, dd MMM yyyy HH:mm:ss");

    /**/* www. j  a va2 s.com*/
     * Formats a Date according to the HTTP specification standard date format.
     *
     * @param date the Date to format.
     * @return a formatted string.
     */
    public static String getHttpDateString(Date date) {
        return HTTP_DATE_FORMAT.format(date) + " GMT";
    }
}

Related

  1. getHttpDate(String value)
  2. getHttpDateFormat()
  3. getHttpDateFormat(String dataFormat, Locale defaultLocale, String defaultTimeZone)
  4. GetHTTPDateFormater()
  5. getHttpDateFormatter()