Skip to content

Commit

Permalink
bpo-19376: Added doc.
Browse files Browse the repository at this point in the history
Added doc mentioning `datetime.strptime()` without a year fails for Feb 29.
  • Loading branch information
toanant committed Feb 17, 2019
1 parent a80af77 commit 941b8cc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2028,6 +2028,9 @@ For :class:`date` objects, the format codes for hours, minutes, seconds, and
microseconds should not be used, as :class:`date` objects have no such
values. If they're used anyway, ``0`` is substituted for them.

For the :meth:`datetime.strptime` class method, the default value is ``1900-01-01T00:00:00.000``:
any components not specified in the format string will be pulled from the default value. [#]_

The full set of format codes supported varies across platforms, because Python
calls the platform C library's :func:`strftime` function, and platform
variations are common. To see the full set of format codes supported on your
Expand Down Expand Up @@ -2256,3 +2259,4 @@ Notes:
.. rubric:: Footnotes

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

0 comments on commit 941b8cc

Please sign in to comment.