java.lang.Object
org.cybergarage.http.Date

public class Dateextends Object
Utility class for handling HTTP date formatting and time operations. Provides methods to format dates according to HTTP standards and create date instances for different time zones.
  • Field Details

    • cal

      private Calendar cal
      The moment this date stands for.
    • MONTH_STRING

      private static final String[] MONTH_STRING
      Month names, in calendar order.
    • WEEK_STRING

      private static final String[] WEEK_STRING
      Weekday names, starting on Sunday.
  • Constructor Details

    • Date

      public Date(Calendar cal)
      Creates a new Date instance with the specified Calendar.
      Parameters:
      cal - the Calendar instance to use
  • Method Details

    • getCalendar

      public Calendar getCalendar()
      Gets the Calendar instance used by this Date.
      Returns:
      the Calendar instance
    • getHour

      public int getHour()
      Gets the hour of the day (24-hour format).
      Returns:
      the hour (0-23)
    • getMinute

      public int getMinute()
      Gets the minute of the hour.
      Returns:
      minute (0-59)
    • getSecond

      public int getSecond()
      Gets the second of the minute.
      Returns:
      second (0-59)
    • getLocalInstance

      public static final Date getLocalInstance()
      Creates a Date instance using the local time zone.
      Returns:
      Date instance with local time
    • getInstance

      public static final Date getInstance()
      Creates a Date instance using GMT time zone.
      Returns:
      Date instance with GMT time
    • toDateString

      public static final String toDateString(int value)
      Converts an integer value to a zero-padded string.
      Parameters:
      value - the integer value to convert
      Returns:
      zero-padded string representation
    • toMonthString

      public static final String toMonthString(int value)
      Converts a month value to its three-letter string representation.
      Parameters:
      value - the month value (Calendar.JANUARY to Calendar.DECEMBER)
      Returns:
      three-letter month string or empty string if invalid
    • toWeekString

      public static final String toWeekString(int value)
      Converts a day of week value to its three-letter string representation.
      Parameters:
      value - the day of week value (Calendar.SUNDAY to Calendar.SATURDAY)
      Returns:
      three-letter day string or empty string if invalid
    • toTimeString

      public static final String toTimeString(int value)
      Converts an integer value to a zero-padded time string.
      Parameters:
      value - the integer value to convert
      Returns:
      zero-padded string representation
    • getDateString

      public String getDateString()
      Gets the date string in RFC 1123 format (e.g., "Tue, 15 Nov 1994 08:12:31 GMT").
      Returns:
      formatted date string
    • getTimeString

      public String getTimeString()
      Gets the time string in HH:MM format with a blinking colon effect. The colon blinks by alternating between ":" and " " based on the second.
      Returns:
      formatted time string with blinking colon