File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -2495,11 +2495,6 @@ These methods accept format codes that can be used to parse and format dates::
24952495 >>> _.strftime('%a %d %b %Y, %I:%M%p')
24962496 'Mon 31 Jan 2022, 11:59PM'
24972497
2498- The user has to make sure, though, that the input can be parsed in a unambiguous
2499- way. The string ``2025112 `` can be parsed using the format ``%Y%m%d `` as ``2025-1-12 ``,
2500- ``2025-11-2 ``, or even ``20251-1-2 ``. It is necessary to add appropriate separators to
2501- reliably get results.
2502-
25032498The following is a list of all the format codes that the 2011 C standard
25042499requires, and these work on all supported platforms.
25052500
@@ -2694,6 +2689,11 @@ For the :meth:`.datetime.strptime` and :meth:`.date.strptime` class methods,
26942689the default value is ``1900-01-01T00:00:00.000 ``: any components not specified
26952690in the format string will be pulled from the default value.
26962691
2692+ .. note ::
2693+ Format strings without separators can be ambiguous for parsing. For
2694+ example, ``%Y%m%d `` parses the string ``2026111 `` as ``2026-11-01 ``,
2695+ not ``2026-01-11 ``. Use separators to ensure the input is parsed as intended.
2696+
26972697.. note ::
26982698 When used to parse partial dates lacking a year, :meth: `.datetime.strptime `
26992699 and :meth: `.date.strptime ` will raise when encountering February 29 because
You can’t perform that action at this time.
0 commit comments