locale.parse(specifier)
Returns a new parser for the given string specifier. The specifier string may contain the same directives as locale.format. The %d
and %e
directives are considered equivalent for parsing.
The returned function parses a specified string, returning the corresponding date or null if the string could not be parsed according to this format’s specifier. Parsing is strict: if the specified string does not exactly match the associated specifier, this method returns null. For example, if the associated specifier is %Y-%m-%dT%H:%M:%SZ
, then the string "2011-07-01T19:15:28Z"
will be parsed as expected, but "2011-07-01T19:15:28"
, "2011-07-01 19:15:28"
and "2011-07-01"
will return null. (Note that the literal Z
here is different from the time zone offset directive %Z
.) If a more flexible parser is desired, try multiple formats sequentially until one returns non-null.
Please login to continue.