Issue #11930: Remove year >= 1000 limitation from datetime.strftime.

Patch by Victor Stinner.
This commit is contained in:
Alexander Belopolsky 2011-05-02 13:14:24 -04:00
parent 9d8c3b7cef
commit 89da349b7b
4 changed files with 6 additions and 41 deletions

View file

@ -1750,8 +1750,7 @@ format codes.
| | decimal number [00,99]. | |
+-----------+--------------------------------+-------+
| ``%Y`` | Year with century as a decimal | \(5) |
| | number [0001,9999] (strptime), | |
| | [1000,9999] (strftime). | |
| | number [0001,9999]. | |
+-----------+--------------------------------+-------+
| ``%z`` | UTC offset in the form +HHMM | \(6) |
| | or -HHMM (empty string if the | |
@ -1785,10 +1784,7 @@ Notes:
calculations when the day of the week and the year are specified.
(5)
For technical reasons, :meth:`strftime` method does not support
dates before year 1000: ``t.strftime(format)`` will raise a
:exc:`ValueError` when ``t.year < 1000`` even if ``format`` does
not contain ``%Y`` directive. The :meth:`strptime` method can
The :meth:`strptime` method can
parse years in the full [1, 9999] range, but years < 1000 must be
zero-filled to 4-digit width.