[Python-checkins] bpo-27741: Better wording for datetime.strptime() (GH-9994)

Miss Islington (bot) webhook-mailer at python.org
Mon Oct 29 07:55:11 EDT 2018


https://github.com/python/cpython/commit/a02bc719ebc496bc527e9e46de2f2e83f68bfd77
commit: a02bc719ebc496bc527e9e46de2f2e83f68bfd77
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-10-29T04:55:08-07:00
summary:

bpo-27741: Better wording for datetime.strptime() (GH-9994)

(cherry picked from commit c0799ec973530ad2492bb1d6c7287ffc428f0348)

Co-authored-by: Gus Goulart <augusto at goulart.me>

files:
M Doc/library/datetime.rst

diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
index a1a60b09cc19..0363111ef55f 100644
--- a/Doc/library/datetime.rst
+++ b/Doc/library/datetime.rst
@@ -2016,7 +2016,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``



More information about the Python-checkins mailing list