Skip to content

Missing valid directive %D in datetime.strftime() documentation #88950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vpjtqwv0101 mannequin opened this issue Jul 30, 2021 · 4 comments
Closed

Missing valid directive %D in datetime.strftime() documentation #88950

vpjtqwv0101 mannequin opened this issue Jul 30, 2021 · 4 comments
Labels
docs Documentation in the Doc dir extension-modules C modules in the Modules dir

Comments

@vpjtqwv0101
Copy link
Mannequin

vpjtqwv0101 mannequin commented Jul 30, 2021

BPO 44787
Nosy @ericvsmith

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2021-07-30.20:24:45.110>
labels = ['3.9']
title = 'Missing valid directive %D in datetime.strftime() documentation'
updated_at = <Date 2021-10-24.13:12:10.462>
user = 'https://bugs.python.org/vpjtqwv0101'

bugs.python.org fields:

activity = <Date 2021-10-24.13:12:10.462>
actor = 'Raphael'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = []
creation = <Date 2021-07-30.20:24:45.110>
creator = 'vpjtqwv0101'
dependencies = []
files = []
hgrepos = []
issue_num = 44787
keywords = []
message_count = 3.0
messages = ['398606', '398609', '404929']
nosy_count = 3.0
nosy_names = ['eric.smith', 'vpjtqwv0101', 'Raphael']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue44787'
versions = ['Python 3.9']

@vpjtqwv0101
Copy link
Mannequin Author

vpjtqwv0101 mannequin commented Jul 30, 2021

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

@vpjtqwv0101 vpjtqwv0101 mannequin added 3.9 only security fixes labels Jul 30, 2021
@ericvsmith
Copy link
Member

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.

@Raphael
Copy link
Mannequin

Raphael mannequin commented Oct 24, 2021

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@iritkatriel iritkatriel added the extension-modules C modules in the Modules dir label Nov 28, 2023
@encukou encukou added docs Documentation in the Doc dir and removed 3.9 only security fixes labels Mar 14, 2025
@encukou
Copy link
Member

encukou commented Mar 14, 2025

A reference to “man strftime” was added in b7117af, and moved to the current place (below the table) in #13410 -- before this PR was filed.
The sentence just above the table also says that only standard format codes are in the table.

I don't think there's anything more to do here.

@encukou encukou closed this as not planned Won't fix, can't repro, duplicate, stale Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir extension-modules C modules in the Modules dir
Projects
Archived in project
Status: Todo
Development

No branches or pull requests

3 participants