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

Data.Time.Asctime

Contents

Description

This module provides functions for ANSI C's asctime() format.

ANSI C's asctime() format looks like:

Wdy Mon [D]D HH:MM:SS YYYY

The exact syntax is as follows:

 date-time ::= wday SP month SP day SP time SP year
 wday      ::= "Mon" | "Tue" | "Wed" | "Thu"
             | "Fri" | "Sat" | "Sun"
 month     ::= "Jan" | "Feb" | "Mar" | "Apr"
             | "May" | "Jun" | "Jul" | "Aug"
             | "Sep" | "Oct" | "Nov" | "Dec"
 day       ::= 2DIGIT | SP 1DIGIT
 time      ::= 2DIGIT ':' 2DIGIT [':' 2DIGIT]
 year      ::= 4DIGIT

As you can see, it has no time zone info. Data.Time.HTTP will treat it as UTC.

Synopsis

Formatting

toAscii :: LocalTime -> AsciiSource

Convert a LocalTime to ANSI C's asctime() string.

toAsciiBuilder :: LocalTime -> AsciiBuilderSource

Convert a LocalTime to ANSI C's asctime() string.

Parsing

fromAscii :: Ascii -> Either String LocalTimeSource

Parse an ANSI C's asctime() string. When the string can't be parsed, it returns Left err.

asctime :: Parser LocalTimeSource

Parse an ANSI C's asctime() string.