Class CacheDateUtils


  • @ProviderType
    public final class CacheDateUtils
    extends Object
    some formatting/parsing functions for the date-format to be used in HTTP headers (see http://tools.ietf.org/html/rfc2616#section-3.3.1)
    • Method Detail

      • formatCurrentTime

        public static String formatCurrentTime()
        Returns:
        the current date and time in RFC-1123 format (e.g. "Sun, 06 Nov 1994 08:49:37 GMT")
      • formatRelativeTime

        public static String formatRelativeTime​(int secondsRelativeToNow)
        Parameters:
        secondsRelativeToNow - offset to the current time (positive or negative!)
        Returns:
        that time in RFC-1123 format (e.g. "Sun, 06 Nov 1994 08:49:37 GMT")
      • parse

        public static Date parse​(String rfc1123Date)
        Parameters:
        rfc1123Date - date and time in RFC-1123 format (e.g. "Sun, 06 Nov 1994 08:49:37 GMT")
        Returns:
        the parsed date
      • getSecondsSince

        public static int getSecondsSince​(String rfc1123Date)
        Parameters:
        rfc1123Date - date and time in RFC-1123 format (e.g. "Sun, 06 Nov 1994 08:49:37 GMT")
        Returns:
        the number of seconds that have passed since the given date
      • getSecondsUntil

        public static int getSecondsUntil​(String rfc1123Date)
        Parameters:
        rfc1123Date - date and time in RFC-1123 format (e.g. "Sun, 06 Nov 1994 08:49:37 GMT")
        Returns:
        the number of seconds until the given date