java.lang.Object
net.i2p.util.RFC822Date

public abstract class RFC822Dateextends Object
Moved from NewsFetcher.
  • Field Details

  • Constructor Details

    • RFC822Date

      public RFC822Date()
      Constructor for subclasses; the formatters in this base class are static.
  • Method Details

    • createDateFormats

      private static SimpleDateFormat[] createDateFormats()
      Build the set of RFC822 date formats used for parsing, all in GMT.
      Returns:
      the array of accepted date formats
    • parse822Date

      public static long parse822Date(String s)
      New Date(String foo) is deprecated, so let's do this the hard way.
      Parameters:
      s - non-null
      Returns:
      -1 on failure
    • to822Date

      public static String to822Date(long t)
      Format is "d MMM yyyy HH:mm:ss z".
      Parameters:
      t - the time to format, in milliseconds since the epoch
      Returns:
      the date rendered as an RFC 822 string in the local time zone
    • main

      public static void main(String[] args)
      Parse the argument and print the formatted date, for testing.
      Parameters:
      args - an optional single epoch-seconds value to format, or none for the current time