Here you can find the source of formatHttpDate(Date date)
public static String formatHttpDate(Date date)
//package com.java2s; /**/*from w w w . jav a 2s .c om*/ * Logspace * Copyright (c) 2015 Indoqa Software Design und Beratung GmbH. All rights reserved. * This program and the accompanying materials are made available under the terms of * the Eclipse Public License Version 1.0, which accompanies this distribution and * is available at http://www.eclipse.org/legal/epl-v10.html. */ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; public class Main { private static final String DATE_FORMAT_RFC1123 = "EEE, dd MMM yyyy HH:mm:ss z"; public static String formatHttpDate(Date date) { return createDateFormat(DATE_FORMAT_RFC1123).format(date); } private static DateFormat createDateFormat(String format) { DateFormat dateFormat = new SimpleDateFormat(format, Locale.ENGLISH); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); return dateFormat; } }