HTTP Date format in Java

by Wolfram Saringer  (2011-05-17)
last change: 2011-05-17

To format a date according to the HTTP standard (needed in the Last Modified header):

public static String formatHttpDate(Date date)
SimpleDateFormat httpDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);

return httpDateFormat.format(date);

all articles represent the sole opinion of their respective author. all content comes without any warranty for correctnes, despite due diligence.