Parses a time value given a format string. Missing information will be
derived from 1970-01-01 00:00 UTC (which was a Thursday). Supports the
same %-codes as
formatTime, including
%-,
%_ and
%0 modifiers, however padding widths are not
supported. Case is not significant in the input string. Some
variations in the input are accepted:
- %z %Ez accepts any of ±HHMM or
±HH:MM.
- %Z %EZ accepts any string of letters, or
any of the formats accepted by %z.
- %0Y accepts exactly four digits.
- %0G accepts exactly four digits.
- %0C accepts exactly two digits.
- %0f accepts exactly two digits.
For example, to parse a date in YYYY-MM-DD format, while allowing the
month and date to have optional leading zeros (notice the
-
modifier used for
%m and
%d):
Prelude Data.Time> parseTimeM True defaultTimeLocale "%Y-%-m-%-d" "2010-3-04" :: Maybe Day
Just 2010-03-04