This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Missing valid directive %D in datetime.strftime() documentation
Type: Stage:
Components: Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Raphael, eric.smith, vpjtqwv0101
Priority: normal Keywords:

Created on 2021-07-30 20:24 by vpjtqwv0101, last changed 2022-04-11 14:59 by admin.

Messages (3)
msg398606 - (view) Author: Marty (vpjtqwv0101) Date: 2021-07-30 20:24
Output of: datetime.datetime.now().strftime('%D')
is equivalent for: datetime.datetime.now().strftime('%m/%d/%y')

Is there a reason that directive %D is missing in documentation? Are there other hidden directives?
https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior
msg398609 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-07-30 21:20
It's dependent on the platform's C library's strftime(). I think (but don't promise) that we document the C89 codes, but each platform might provide additional ones.
msg404929 - (view) Author: (Raphael) Date: 2021-10-24 13:12
Perhaps it could be mentioned more clearly in the datetime documentation that apart from the directives of the C89 standard, you can also use those that the underlying libc strftime() supports.

The following sentence from https://docs.python.org/3/library/time.html#time.strftime describes it well in my opinion:
"Additional directives may be supported on certain platforms, but only the ones listed here have a meaning standardized by ANSI C."

Perhaps a reference to "man strftime" would also be helpful.
History
Date User Action Args
2022-04-11 14:59:48adminsetgithub: 88950
2021-10-24 13:12:10Raphaelsetnosy: + Raphael
messages: + msg404929
2021-07-30 21:20:36eric.smithsetnosy: + eric.smith
messages: + msg398609
2021-07-30 20:24:45vpjtqwv0101create