Skip to content

Commit 390d88e

Browse files
taleinattoanant
andauthored
[3.7] bpo-19376: Added doc mentioning datetime.strptime() without a year fails for Feb 29. (GH-10243)
(cherry picked from commit 56027cc) Co-authored-by: Abhishek Kumar Singh <[email protected]>
1 parent 6b48e65 commit 390d88e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Doc/library/datetime.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2031,6 +2031,9 @@ For :class:`date` objects, the format codes for hours, minutes, seconds, and
20312031
microseconds should not be used, as :class:`date` objects have no such
20322032
values. If they're used anyway, ``0`` is substituted for them.
20332033

2034+
For the :meth:`datetime.strptime` class method, the default value is ``1900-01-01T00:00:00.000``:
2035+
any components not specified in the format string will be pulled from the default value. [#]_
2036+
20342037
The full set of format codes supported varies across platforms, because Python
20352038
calls the platform C library's :func:`strftime` function, and platform
20362039
variations are common. To see the full set of format codes supported on your
@@ -2265,3 +2268,4 @@ Notes:
22652268
.. rubric:: Footnotes
22662269

22672270
.. [#] If, that is, we ignore the effects of Relativity
2271+
.. [#] Passing ``datetime.strptime('Feb 29', '%b %d')`` will fail since ``1900`` is not a leap year.

0 commit comments

Comments
 (0)