parseTime

Deprecated: use "parseTimeM True" instead
Parse a string as a ParseTime instance value. Return Nothing if parsing fails.

Examples

ISO 8601

> parseTime defaultTimeLocale "%Y-%m-%dT%H:%M:%S%N" "2015-01-15T12:34:56+00:00" :: Maybe UTCTime
Just 2015-01-15 12:34:56 UTC

> parseTime defaultTimeLocale "%Y-%m-%dT%H:%M:%S%N" "2015-01-15T12:34:56-12:00" :: Maybe UTCTime
Just 2015-01-16 00:34:56 UTC

YYYY-MM-DD hh:mm:ss.0

> parseTime defaultTimeLocale "%Y-%m-%d %H:%M:%S%Q" "2015-01-15 12:34:56.78" :: Maybe UTCTime
Just 2015-01-15 12:34:56.78 UTC
Parse a Time of the form `00:00:00.000`. This is ffmpeg's format.
The class of types which can be parsed given a UNIX-style time format string.
The class of types which can be parsed given a UNIX-style time format string.
All instances of this class may be parsed by parseTime, readTime, and readsTime.
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
Parses a time value given a list of pairs of format and input. Resulting value is constructed from all provided specifiers.
Parse a time value given a format string. Fails if the input could not be parsed using the given format. See parseTimeM for details.
Get the string corresponding to the given format specifier.
Parses a time value given a format string. 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 accepts any of ±HHMM or ±HH:MM.
  • %Z 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
Parse a time of the form HH:MM[:SS[.SSS]].
Parse a time zone. The accepted formats are Z, +HH, +HHMM, or +HH:MM. (+ can be -). Accepts -23:59..23:59 range, i.e. HH < 24 and MM < 59. (This is consistent with grammar, and with what Python, Clojure, joda-time do).