Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2703,6 +2703,13 @@ in the format string will be pulled from the default value.
the default year of 1900 is *not* a leap year. Always add a default leap
year to partial date strings before parsing.

.. note::
If a :meth:`~.datetime.strptime` format string contains more than
one directive for the same field, for example both ``%Y`` and ``%y``,
every directive must still match the input, but only the value of the
last one is used. For example, parsing ``200099`` with ``%Y%y`` gives
the year 1999. Repeating the same directive, like ``%Y%Y``, raises an error.

.. testsetup::

# doctest seems to turn the warning into an error which makes it
Expand Down
Loading