Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2997837

Browse files
committed
Fixed documentation to reflect recent changes for years < 1900.
1 parent 3ec899f commit 2997837

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

Doc/library/datetime.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,8 +1661,12 @@ version) requires, and these work on all platforms with a standard C
16611661
implementation. Note that the 1999 version of the C standard added additional
16621662
format codes.
16631663

1664-
The exact range of years for which :meth:`strftime` works also varies across
1665-
platforms. Regardless of platform, years before 1900 cannot be used.
1664+
The exact range of years for which :meth:`strftime` works also varies
1665+
across platforms. Regardless of platform, years before 1000 cannot be
1666+
used with ``datetime`` module ``strftime()`` methods. The ``time``
1667+
module ``strftime()`` function exibit different behavior depending on
1668+
the value of ``time.accept2dyear`` variable. See :ref:`Year 2000
1669+
(Y2K) issues <time-y2kissues>` for details.
16661670

16671671
+-----------+--------------------------------+-------+
16681672
| Directive | Meaning | Notes |

Doc/library/time.rst

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,19 @@ The module defines the following functions and data items:
120120

121121
.. data:: accept2dyear
122122

123-
Boolean value indicating whether two-digit year values will be accepted. This
124-
is true by default, but will be set to false if the environment variable
125-
:envvar:`PYTHONY2K` has been set to a non-empty string. It may also be modified
126-
at run time.
123+
Boolean value indicating whether two-digit year values will be
124+
mapped to 1969--2068 range by :func:`asctime`, :func:`mktime`, and
125+
:func:`strftime` functions. This is true by default, but will be
126+
set to false if the environment variable :envvar:`PYTHONY2K` has
127+
been set to a non-empty string. It may also be modified at run
128+
time.
129+
130+
.. deprecated:: 3.2
131+
Mapping of 2-digit year values by :func:`asctime`,
132+
:func:`mktime`, and :func:`strftime` functions to 1969--2068
133+
range is deprecated. Programs that need to process 2-digit
134+
years should use ``%y`` code available in :func:`strptime`
135+
function or convert 2-digit year values to 4-digit themselves.
127136

128137

129138
.. data:: altzone

0 commit comments

Comments
 (0)