java.lang.Object
org.cybergarage.http.Date
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 Summary
Constructor Summary
Method Summary
Modifier and TypeMethodDescriptionGets the Calendar instance used by this Date.Gets the date string in RFC 1123 format (e.g., "Tue, 15 Nov 1994 08:12:31 GMT").intgetHour()Gets the hour of the day (24-hour format).static final DateCreates a Date instance using GMT time zone.static final DateCreates a Date instance using the local time zone.intGets the minute of the hour.intGets the second of the minute.Gets the time string in HH:MM format with a blinking colon effect.static final StringtoDateString(int value) Converts an integer value to a zero-padded string.static final StringtoMonthString(int value) Converts a month value to its three-letter string representation.static final StringtoTimeString(int value) Converts an integer value to a zero-padded time string.static final StringtoWeekString(int value) Converts a day of week value to its three-letter string representation.
Field Details
cal
The moment this date stands for.MONTH_STRING
Month names, in calendar order.WEEK_STRING
Weekday names, starting on Sunday.
Constructor Details
Date
Creates a new Date instance with the specified Calendar.- Parameters:
cal- the Calendar instance to use
Method Details
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
Creates a Date instance using the local time zone.- Returns:
- Date instance with local time
getInstance
Creates a Date instance using GMT time zone.- Returns:
- Date instance with GMT time
toDateString
Converts an integer value to a zero-padded string.- Parameters:
value- the integer value to convert- Returns:
- zero-padded string representation
toMonthString
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
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
Converts an integer value to a zero-padded time string.- Parameters:
value- the integer value to convert- Returns:
- zero-padded string representation
getDateString
Gets the date string in RFC 1123 format (e.g., "Tue, 15 Nov 1994 08:12:31 GMT").- Returns:
- formatted date 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