This package provides functionalities to parse and format W3C
Date and Time. The package can also be used to convert it from/to
Data.Time.Calendar.Day
and Data.Time.LocalTime.ZonedTime
.
- data W3CDateTime = W3CDateTime {}
- format :: Convertible t W3CDateTime => t -> String
- parse :: Convertible W3CDateTime t => String -> Maybe t
Documentation
data W3CDateTime
W3CDateTime
represents a W3C Date and Time format.
The field w3cYear
is mandatory while other fields are
optional. But you should be careful about combinations of such
optional fields. No combinations are allowed except for the
following list:
- YYYY
- YYYY-MM
- YYYY-MM-DD
- YYYY-MM-DDThh:mmTZD
- YYYY-MM-DDThh:mm:ss.sTZD
This data type is partially ordered so we can't make it an
instance of Ord (e.g. "2010"
and "2010-01"
can't be
compared).
Eq W3CDateTime | |
Show W3CDateTime | |
Typeable W3CDateTime | |
Convertible ZonedTime W3CDateTime | |
Convertible Day W3CDateTime | |
Convertible W3CDateTime ZonedTime | |
Convertible W3CDateTime Day | |
Convertible W3CDateTime W3CDateTime |
format :: Convertible t W3CDateTime => t -> String
Format W3C Date and Time string from anything convertible to
W3CDateTime
type. The most obvious acceptable type is the
W3CDateTime
itself.
parse :: Convertible W3CDateTime t => String -> Maybe t
Parse W3C Date and Time string to anything convertible from
W3CDateTime
type. The most obvious acceptable type is the
W3CDateTime
itself. If the given string is ill-formatted, parse
returns Nothing
.