Skip to content

Commit 998e4e8

Browse files
*Borrow* GNU docs wording
1 parent c149570 commit 998e4e8

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Doc/library/datetime.rst

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,6 +2465,11 @@ These methods accept format codes that can be used to parse and format dates::
24652465
>>> _.strftime('%a %d %b %Y, %I:%M%p')
24662466
'Mon 31 Jan 2022, 11:59PM'
24672467

2468+
The user has to make sure, though, that the input can be parsed in a unambiguous
2469+
way. The string ``2025112`` can be parsed using the format ``%Y%m%d`` as ``2025-1-12``,
2470+
``2025-11-2``, or even ``20251-1-2``. It is necessary to add appropriate separators to
2471+
reliably get results.
2472+
24682473
The following is a list of all the format codes that the 1989 C standard
24692474
requires, and these work on all platforms with a standard C implementation.
24702475

@@ -2599,14 +2604,6 @@ method. The ISO 8601 year and ISO 8601 week directives are not interchangeable
25992604
with the year and week number directives above. Calling :meth:`~.datetime.strptime` with
26002605
incomplete or ambiguous ISO 8601 directives will raise a :exc:`ValueError`.
26012606

2602-
.. Note::
2603-
Input will be split to cope with the provided directives in the format string,
2604-
this aligns with the behaviour of the C implementation.::
2605-
2606-
>>> datetime.strptime('20250310T12','%Y%m%dT%H%M')
2607-
datetime.datetime(2025, 3, 10, 1, 2)
2608-
2609-
26102607
The full set of format codes supported varies across platforms, because Python
26112608
calls the platform C library's :c:func:`strftime` function, and platform
26122609
variations are common. To see the full set of format codes supported on your

0 commit comments

Comments
 (0)