Skip to content

Commit f8937f1

Browse files
committed
adjust and reorganize the notes location, fast forward to latest.
1 parent 196f391 commit f8937f1

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎Doc/library/datetime.rst‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2745,6 +2745,14 @@ in the format string will be pulled from the default value.
27452745
the default year of 1900 is *not* a leap year. Always add a default leap
27462746
year to partial date strings before parsing.
27472747

2748+
.. note::
2749+
When parsing a string using :meth:`.datetime.strptime` or
2750+
:meth:`.date.strptime`, if more than one directive for the same time unit
2751+
is used, only the last directive is parsed and applied to the resulting
2752+
object. For example, if the format string contains both ``%Y`` and ``%y``,
2753+
like ``%Y%y``, only the last directive in the string (``%y``) determines
2754+
the year of the result.
2755+
27482756
.. testsetup::
27492757

27502758
# doctest seems to turn the warning into an error which makes it
@@ -2924,14 +2932,6 @@ Notes:
29242932
:meth:`~.datetime.strptime` calls using a format string containing
29252933
``%e`` without a year now emit a :exc:`DeprecationWarning`.
29262934

2927-
(11)
2928-
When parsing a string using :meth:`~.datetime.strptime`, if more than one
2929-
directives of the same time unit were used, only the last directive gets parsed
2930-
and applied to the datetime object. For example, if the format string contains
2931-
both ``%Y`` and ``%y``, like ``%Y%y``, only the last directive on the string (``%y``)
2932-
gets used on the resulting datetime object.
2933-
2934-
29352935
.. rubric:: Footnotes
29362936

29372937
.. [#] If, that is, we ignore the effects of relativity.

0 commit comments

Comments
 (0)