We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 827db45 commit 1d916a0Copy full SHA for 1d916a0
1 file changed
Misc/NEWS.d/next/Library/2024-09-30-04-49-22.gh-issue-124529.hDDlMH.rst
@@ -0,0 +1,9 @@
1
+Fix :meth:`datetime.datetime.strptime`, :meth:`datetime.date.strptime` as
2
+well as :func:`time.strptime` (by modifying :class:`_strptime.TimeRE`) to
3
+make ``%c`` and ``%x`` accept year number representations consisting of
4
+fewer digits than the usual four or two (note that nothing changes for
5
+``%Y`` and ``%y``). Thanks to that, certain ``strftime/strptime`` round
6
+trips (such as ``datetime.strptime(dt.strftime("%c"), "%c"))`` for
7
+``dt.year`` less than 1000) no longer raise ``ValueError`` for some
8
+locales/platforms (this was the case, e.g., on Linux -- for various
9
+locales, including ``C``/``C.UTF-8``).
0 commit comments