Skip to content

Instantly share code, notes, and snippets.

-- | Converts a 'ClockTime' into an HTTP timestamp.
formatHttpTime :: UTCTime -> ByteString
formatHttpTime = fromStr . formatTime defaultTimeLocale "%a, %d %b %Y %X GMT"
-- | Converts an HTTP timestamp into a 'UTCTime'.
parseHttpTime :: ByteString -> Maybe UTCTime
parseHttpTime s' =
parseTime defaultTimeLocale "%a, %d %b %Y %H:%M:%S GMT" s
where
s = toStr s'
h x=maximum$0:[y|(l,y,r)<-b,l<=x,x<r]
print[(x,h x)|x<-[1..9999],h x/=h(x-1)]