]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-27741: Better wording for datetime.strptime() (GH-9994)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 29 Oct 2018 11:54:54 +0000 (04:54 -0700)
committerGitHub <noreply@github.com>
Mon, 29 Oct 2018 11:54:54 +0000 (04:54 -0700)
(cherry picked from commit c0799ec973530ad2492bb1d6c7287ffc428f0348)

Co-authored-by: Gus Goulart <augusto@goulart.me>
Doc/library/datetime.rst

index 26cb90b6207c17c2c2ab3e74eb6568dc15899b74..f2bdf8d68fb720da4ddaa9de821c07cc732b15ba 100644 (file)
@@ -1944,7 +1944,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``