diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-10-29 04:55:15 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-29 04:55:15 -0700 |
commit | 4ec427b005036dab0a380de20f31774394ca4dd6 (patch) | |
tree | 86b739d53939ee9103a053bd98f71f8665197133 /Doc | |
parent | d61f586df79a754776f448e5b23015abb71f4fd1 (diff) | |
download | cpython-git-4ec427b005036dab0a380de20f31774394ca4dd6.tar.gz |
bpo-27741: Better wording for datetime.strptime() (GH-9994)
(cherry picked from commit c0799ec973530ad2492bb1d6c7287ffc428f0348)
Co-authored-by: Gus Goulart <augusto@goulart.me>
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/datetime.rst | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index d2c1c56386..1e575d5d57 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1594,7 +1594,9 @@ although not all objects support a :meth:`timetuple` method. Conversely, the :meth:`datetime.strptime` class method creates a :class:`.datetime` object from a string representing a date and time and a corresponding format string. ``datetime.strptime(date_string, format)`` is -equivalent to ``datetime(*(time.strptime(date_string, format)[0:6]))``. +equivalent to ``datetime(*(time.strptime(date_string, format)[0:6]))``, except +when the format includes sub-second components or timezone offset information, +which are supported in ``datetime.strptime`` but are discarded by ``time.strptime``. For :class:`.time` objects, the format codes for year, month, and day should not be used, as time objects have no such values. If they're used anyway, ``1900`` |