X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=time-http.git;a=blobdiff_plain;f=Data%2FTime%2FRFC1123.hs;h=43594c5d6f7b715fb383c3a1909d99c6cab89120;hp=bf68f057704661b6b7b9617a6068761fff441213;hb=42ffc2dd3bba56145796d381e2570739c32d7d74;hpb=469170632eee26999634929f964d9cc71e068bf3 diff --git a/Data/Time/RFC1123.hs b/Data/Time/RFC1123.hs index bf68f05..43594c5 100644 --- a/Data/Time/RFC1123.hs +++ b/Data/Time/RFC1123.hs @@ -1,3 +1,14 @@ +-- |This module provides functions to parse and format RFC 1123 date +-- and time formats. +-- +-- The format is basically same as RFC 822, but the syntax for @date@ +-- is changed from: +-- +-- > year ::= 2DIGIT +-- +-- to: +-- +-- > year ::= 4DIGIT module Data.Time.RFC1123 ( format , parse @@ -12,12 +23,7 @@ import Data.Time.HTTP.Common import Data.Time.RFC822 (showRFC822TimeZone) import Data.Time.RFC1123.Parsec -{- - The syntax for the date is hereby changed to: - - date = 1*2DIGIT month 2*4DIGIT --} - +-- |Format a 'ZonedTime' in RFC 1123. format :: ZonedTime -> String format zonedTime = let localTime = zonedTimeToLocalTime zonedTime @@ -43,6 +49,8 @@ format zonedTime , showRFC822TimeZone timeZone ] +-- |Parse an RFC 1123 date and time string. When the string can't be +-- parsed, it returns 'Nothing'. parse :: String -> Maybe ZonedTime parse src = case P.parse p "" src of Right zt -> Just zt