Java HTTP Date gethttpDate()

Here you can find the source of gethttpDate()

Description

Generate an rfc822 date for use in the Date HTTP header.

License

Open Source License

Declaration

public static String gethttpDate() 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.Locale;
import java.util.TimeZone;

public class Main {
    /**/*from w w  w. ja  v  a  2s .  c  o m*/
     * Generate an rfc822 date for use in the Date HTTP header.
     */
    public static String gethttpDate() {
        final String DateFormat = "EEE, dd MMM yyyy HH:mm:ss ";
        SimpleDateFormat format = new SimpleDateFormat(DateFormat, Locale.US);
        format.setTimeZone(TimeZone.getTimeZone("GMT"));
        return format.format(new Date()) + "GMT";
    }
}

Related

  1. getHttpDate()
  2. getHTTPDate()
  3. getHttpDate()
  4. getHttpDate(int days)
  5. getHttpDate(long l)