Skip to content

Commit 0a53a06

Browse files
bpo-27741: Better wording for datetime.strptime() (GH-9994)
(cherry picked from commit c0799ec) Co-authored-by: Gus Goulart <[email protected]>
1 parent 86a0f22 commit 0a53a06

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Doc/library/datetime.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1944,7 +1944,9 @@ although not all objects support a :meth:`timetuple` method.
19441944
Conversely, the :meth:`datetime.strptime` class method creates a
19451945
:class:`.datetime` object from a string representing a date and time and a
19461946
corresponding format string. ``datetime.strptime(date_string, format)`` is
1947-
equivalent to ``datetime(*(time.strptime(date_string, format)[0:6]))``.
1947+
equivalent to ``datetime(*(time.strptime(date_string, format)[0:6]))``, except
1948+
when the format includes sub-second components or timezone offset information,
1949+
which are supported in ``datetime.strptime`` but are discarded by ``time.strptime``.
19481950

19491951
For :class:`.time` objects, the format codes for year, month, and day should not
19501952
be used, as time objects have no such values. If they're used anyway, ``1900``

0 commit comments

Comments
 (0)