time-http-0.5: Parse and format HTTP/1.1 Date and Time strings

Data.Time.Format.RFC822

Description

This module provides functions to parse and format RFC 822 date and time strings (http://tools.ietf.org/html/rfc822#section-5).

The syntax is as follows:

 date-time   ::= [ day-of-week ", " ] date SP time SP zone
 day-of-week ::= "Mon" | "Tue" | "Wed" | "Thu"
               | "Fri" | "Sat" | "Sun"
 date        ::= day SP month SP year
 day         ::= 2DIGIT
 year        ::= 2DIGIT             ; Yes, only 2 digits.
 month       ::= "Jan" | "Feb" | "Mar" | "Apr"
               | "May" | "Jun" | "Jul" | "Aug"
               | "Sep" | "Oct" | "Nov" | "Dec"
 time        ::= hour ":" minute [ ":" second ]
 hour        ::= 2DIGIT
 minute      ::= 2DIGIT
 second      ::= 2DIGIT
 zone        ::= "UT"  | "GMT"      ; Universal Time
               | "EST" | "EDT"      ; Eastern : -5 / -4
               | "CST" | "CDT"      ; Central : -6 / -5
               | "MST" | "MDT"      ; Mountain: -7 / -6
               | "PST" | "PDT"      ; Pacific : -8 / -7
               | "Z"                ; UT
               | "A"                ;  -1
               | "M"                ; -12
               | "N"                ;  +1
               | "Y"                ; +12
               | ("+" | "-") 4DIGIT ; Local diff: HHMM

Synopsis

Documentation

data RFC822 Source

The phantom type for conversions between RFC 822 date and time strings and ZonedTime.

>>> convertAttempt (Tagged (ZonedTime (LocalTime (ModifiedJulianDay 49662) (TimeOfDay 8 49 37)) utc) :: Tagged RFC822 ZonedTime)
Success "Sun, 06 Nov 94 08:49:37 GMT"

Note that RFC 822 has a Y2K problem so converting ZonedTime whose gregorian year is earlier than 1900 or from 2000 onward results in ConvertBoundsException Day (Tagged RFC822 ZonedTime).

Instances

Typeable RFC822 
ConvertAttempt Ascii (Tagged RFC822 ZonedTime) 
Default (Parser (Tagged RFC822 ZonedTime))

Parse an RFC 822 date and time string.

Default (Parser (Tagged RFC822 TimeOfDay)) 
Default (Parser (Tagged RFC822 TimeZone)) 
ConvertSuccess (Tagged RFC822 TimeZone) AsciiBuilder 
ConvertSuccess (Tagged RFC822 TimeZone) Ascii 
ConvertAttempt (Tagged RFC822 ZonedTime) AsciiBuilder 
ConvertAttempt (Tagged RFC822 ZonedTime) Ascii 
ConvertAttempt (Tagged RFC822 TimeZone) AsciiBuilder 
ConvertAttempt (Tagged RFC822 TimeZone) Ascii