private static String toCookieDate(Date date) {
        TimeZone tz = TimeZone.getTimeZone(GMT_TIME_ZONE_ID);
        DateFormat fmt = new SimpleDateFormat(COOKIE_DATE_FORMAT_STRING, Locale.US);
        fmt.setTimeZone(tz);
        return fmt.format(date);
    }
Formats a date into a cookie date compatible string (Netscape's specification).

@param date the date to format
@return an HTTP 1.0/1.1 Cookie compatible date string (GMT-based).
web/src/main/java/org/apache/shiro/web/servlet/SimpleCookie.java