Safe Haskell | None |
---|---|
Language | Haskell98 |
This module allows to parse arbitrary date formats. Date formats are specified as strings:
- DD.MM.YYY
- "YYYY/MM/DD"
- "DD/MM/YYYY, HH:mm:SS"
- "YY.MM.DD[, HH:mm:SS]"
- and so on.
Synopsis
- data FormatElement
- type Format = [FormatElement]
- type FormatParser a = Parsec String Bool a
- parseFormat :: String -> Either ParseError Format
- pFormat :: FormatParser Format
- formatParser :: Stream s m Char => Format -> ParsecT s st m DateTime
- parseDateFormat :: String -> String -> Either ParseError DateTime
Documentation
data FormatElement Source #
Date/time format element
YEAR Bool Int | |
MONTH Bool Int | |
DAY Bool Int | |
HOUR Bool Int | |
MINUTE Bool Int | |
SECOND Bool Int | |
Whitespace Bool | |
Fixed Bool String |
Instances
Eq FormatElement Source # | |
Defined in Data.Dates.Formats (==) :: FormatElement -> FormatElement -> Bool # (/=) :: FormatElement -> FormatElement -> Bool # | |
Show FormatElement Source # | |
Defined in Data.Dates.Formats showsPrec :: Int -> FormatElement -> ShowS # show :: FormatElement -> String # showList :: [FormatElement] -> ShowS # |
type Format = [FormatElement] Source #
Date/time format
parseFormat :: String -> Either ParseError Format Source #
formatParser :: Stream s m Char => Format -> ParsecT s st m DateTime Source #
Make Parser for specified date format.
Parse date/time in specified format.