code: public static String formatDate(StringBuffer buf, long date, boolean cookie)
      {
          HttpCal gc = new HttpCal();
          gc.setTimeInMillis(date);
          formatDate(buf,gc,cookie);
          return buf.toString();
      }
docs: Format HTTP date
  "EEE, dd MMM yyyy HH:mm:ss 'GMT'" or
  "EEE, dd-MMM-yy HH:mm:ss 'GMT'"for cookies