Skip to content

Commit c0799ec

Browse files
augustogoulartvstinner
authored andcommitted
bpo-27741: Better wording for datetime.strptime() (GH-9994)
1 parent 53835e9 commit c0799ec

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
@@ -2016,7 +2016,9 @@ although not all objects support a :meth:`timetuple` method.
20162016
Conversely, the :meth:`datetime.strptime` class method creates a
20172017
:class:`.datetime` object from a string representing a date and time and a
20182018
corresponding format string. ``datetime.strptime(date_string, format)`` is
2019-
equivalent to ``datetime(*(time.strptime(date_string, format)[0:6]))``.
2019+
equivalent to ``datetime(*(time.strptime(date_string, format)[0:6]))``, except
2020+
when the format includes sub-second components or timezone offset information,
2021+
which are supported in ``datetime.strptime`` but are discarded by ``time.strptime``.
20202022

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

0 commit comments

Comments
 (0)