{-# LANGUAGE FlexibleContexts #-} module Data.Time.HTTP.Internal ( rfc2616DateAndTime ) where import Control.Monad import Data.Time import Data.Time.RFC1123.Internal import Data.Time.RFC733.Internal import Data.Time.Asctime.Internal -- |This is a parsec parser for date and time formats allowed in -- HTTP\/1.1 (RFC 2616). rfc2616DateAndTime :: Stream s m Char => ParsecT s u m UTCTime rfc2616DateAndTime = choice [ liftM zonedTimeToUTC $ try rfc1123DateAndTime , liftM zonedTimeToUTC $ try rfc733DateAndTime , liftM (localTimeToUTC utc) asctime ]