diff options
author | Paul Dickson <prdickson@users.noreply.github.com> | 2018-06-08 11:13:20 +0100 |
---|---|---|
committer | Paul Ganssle <paul@ganssle.io> | 2018-06-20 10:38:29 -0400 |
commit | c1fa196e44711e16c8309a14a1e913ba043088f6 (patch) | |
tree | e377c2d1673d3426cc5b61c9c9022507a2531163 /docs/examples.rst | |
parent | ef6cddd64808bc1cf67d378f7c9136d9757be6ca (diff) | |
download | dateutil-c1fa196e44711e16c8309a14a1e913ba043088f6.tar.gz |
Added a parser example for overriding parserinfo
In conjunction with GH issue #426.
Diffstat (limited to 'docs/examples.rst')
-rw-r--r-- | docs/examples.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/examples.rst b/docs/examples.rst index 2b98dbd..21270ca 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -1190,6 +1190,19 @@ Other random formats: datetime.datetime(1990, 6, 13, 5, 50) +Override parserinfo with a custom parserinfo + +.. doctest:: tz + + >>> from dateutil.parser import parse, parserinfo + >>> class CustomParserInfo(parserinfo): + ... # e.g. edit a property of parserinfo to allow a custom 12 hour format + ... AMPM = [("am", "a", "xm"), ("pm", "p")] + >>> parse('2018-06-08 12:06:58 XM', parserinfo=CustomParserInfo()) + datetime.datetime(2018, 6, 8, 0, 6, 58) + + + tzutc examples -------------- |