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

(cherry picked from commit c0799ec973)

Co-authored-by: Gus Goulart <augusto@goulart.me>
This commit is contained in:
Miss Islington (bot) 2018-10-29 04:55:15 -07:00 committed by GitHub
parent d61f586df7
commit 4ec427b005
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -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``