Parser for the HTTP date format. This will parse the 3 formats that are acceptable for the HTTP/1.1 date. The three formats that are acceptable for the HTTP-date are Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
This can also parse the date in ms as retrived from the System's System.currentTimeMillis method. This has a parse method for a long which will do the same as the parse(String). Once the date has been parsed there are two methods that allow the date to be represented, the toLong method converts the date to a long and the toString method will convert the date into a String.
This produces the same string as the SimpleDateFormat.format using the pattern "EEE, dd MMM yyyy hh:mm:ss 'GMT'". This will however do the job faster as it does not take arbitrary inputs.
@author Niall Gallagher
| |
| |