public class HttpDate
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ANSI_C_ASCTIME_DATE
Indicates to
getHttpDate() to use ANSI C asctime() function date format
when returning the string representation of a date. |
static java.lang.String |
asctimeDateFormat
Time format string representing a date based on RFC 1123.
|
static int |
RFC_1123
Indicates to
getHttpDate() to use RFC-1123 date format when returning
the string representation of a date. |
static int |
RFC_850
Indicates to
getHttpDate() to use RFC-850 date format when returning
the string representation of a date. |
static java.lang.String |
rfc1123DateFormat
Time format string representing a date based on RFC 1123.
|
static java.lang.String |
rfc850DateFormat
Time format string representing a date based on RFC 1123.
|
| Constructor and Description |
|---|
HttpDate() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.Date |
getHttpDate(java.lang.String dateString)
This method converts a string containing an HTTP date as described in RFC 2616 into
a java.util.Date object.
|
static java.lang.String |
getHttpDateString(java.util.Date d)
Converts a java.util.Date to an HTTP/1.1 date string.
|
static java.lang.String |
getHttpDateString(java.util.Date d,
int format)
Converts a java.util.Date to an HTTP/1.1 date string.
|
static void |
main(java.lang.String[] args)
Provides a simple experiments of this classes date handling methods.
|
public static final int RFC_1123
getHttpDate() to use RFC-1123 date format when returning
the string representation of a date.public static final int RFC_850
getHttpDate() to use RFC-850 date format when returning
the string representation of a date.public static final int ANSI_C_ASCTIME_DATE
getHttpDate() to use ANSI C asctime() function date format
when returning the string representation of a date.public static final java.lang.String rfc1123DateFormat
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
public static final java.lang.String rfc850DateFormat
Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
public static final java.lang.String asctimeDateFormat
Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
public static java.util.Date getHttpDate(java.lang.String dateString)
HTTP-date = rfc1123-date | rfc850-date | asctime-date
rfc1123-date = wkday "," SP date1 SP time SP "GMT"
rfc850-date = weekday "," SP date2 SP time SP "GMT"
asctime-date = wkday SP date3 SP time SP 4DIGIT
date1 = 2DIGIT SP month SP 4DIGIT
; day month year (e.g., 02 Jun 1982)
date2 = 2DIGIT "-" month "-" 2DIGIT
; day-month-year (e.g., 02-Jun-82)
date3 = month SP ( 2DIGIT | ( SP 1DIGIT ))
; month day (e.g., Jun 2)
time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
; 00:00:00 - 23:59:59
wkday = "Mon" | "Tue" | "Wed"
| "Thu" | "Fri" | "Sat" | "Sun"
weekday = "Monday" | "Tuesday" | "Wednesday"
| "Thursday" | "Friday" | "Saturday" | "Sunday"
month = "Jan" | "Feb" | "Mar" | "Apr"
| "May" | "Jun" | "Jul" | "Aug"
| "Sep" | "Oct" | "Nov" | "Dec"
dateString - A String containing an HTTP date.public static java.lang.String getHttpDateString(java.util.Date d)
d - The Date we want to get an HTTP representation for.public static java.lang.String getHttpDateString(java.util.Date d,
int format)
format.
d - The Date we want to get an HTTP representation for.format - The format id for the format to use in representing the date as a String.public static void main(java.lang.String[] args)
args - Um... arguments!