Class Rfc822Date

java.lang.Object
net.targetr.wtm3.io.Rfc822Date

public class Rfc822Date extends Object
Parses and formats RFC-822 dates. GMT ONLY!

This class is designed to quickly parse and format dates in the style specified in RFC-822. Unlike SimpleDateFormat it is thread safe and lightweight.

Author:
Dr Michael Gardiner
  • Method Details

    • formatDate

      public static String formatDate(long time)
      Returns a string in RFC-822 format.
      Parameters:
      time - The time in millis since epoc to format.
      Returns:
      The time as a string suitable for HTTP headers.
    • formatCookieDate

      public static String formatCookieDate(long time)
      Returns a string in RFC-822 format for Cookies. (Dashes between date components)
      Parameters:
      time - The time in millis since epoc to format.
      Returns:
      The time as a string suitable for HTTP headers.
    • parseDate

      public static long parseDate(String str)
      Parses a string in RFC-822 format.
      Parameters:
      str - The date in RFC-822 date format.
      Returns:
      The number of millis since epoc.