Safe Haskell | None |
---|---|
Language | Haskell2010 |
Fast parser and formatter for HTTP Date.
Synopsis
- epochTimeToHTTPDate :: EpochTime -> HTTPDate
- httpDateToUTC :: HTTPDate -> UTCTime
- utcToHTTPDate :: UTCTime -> HTTPDate
- data HTTPDate
- hdYear :: HTTPDate -> Int
- hdMonth :: HTTPDate -> Int
- hdDay :: HTTPDate -> Int
- hdHour :: HTTPDate -> Int
- hdMinute :: HTTPDate -> Int
- hdSecond :: HTTPDate -> Int
- hdWkday :: HTTPDate -> Int
- defaultHTTPDate :: HTTPDate
- parseHTTPDate :: ByteString -> Maybe HTTPDate
- formatHTTPDate :: HTTPDate -> ByteString
Documentation
Data structure for HTTP Date. This value should be specified
with defaultHTTPDate
and its field labels.
defaultHTTPDate :: HTTPDate Source #
A default value for HTTPDate
.
Utility functions
parseHTTPDate :: ByteString -> Maybe HTTPDate Source #
Parsing HTTP Date. Currently only RFC1123 style is supported.
>>>
parseHTTPDate "Tue, 15 Nov 1994 08:12:31 GMT"
Just (HTTPDate {hdYear = 1994, hdMonth = 11, hdDay = 15, hdHour = 8, hdMinute = 12, hdSecond = 31, hdWkday = 2})
formatHTTPDate :: HTTPDate -> ByteString Source #
Generating HTTP Date in RFC1123 style.
>>>
formatHTTPDate defaultHTTPDate {hdYear = 1994, hdMonth = 11, hdDay = 15, hdHour = 8, hdMinute = 12, hdSecond = 31, hdWkday = 2}
"Tue, 15 Nov 1994 08:12:31 GMT"