8000 gh-98378: Add small format string example to strftime comments (GH-98… · python/cpython@6ccca69 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6ccca69

Browse files
authored
gh-98378: Add small format string example to strftime comments (GH-98379)
A small example of what a full date and time would look like would help a lot of developers who may not realize that they should investigate `time.h`'s `strftime`, run `man strftime`, or click through a series of docs on the python docs before they get to the actual [definition here](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes) which still doesn't have an obvious copy-pastable example of "what the heck format does this thing actually expect?". Automerge-Triggered-By: GH:rhettinger
1 parent 0bbea54 commit 6ccca69

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Lib/datetime.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,11 @@ def ctime(self):
10331033
self._day, self._year)
10341034

10351035
def strftime(self, fmt):
1036-
"Format using strftime()."
1036+
"""
1037+
Format using strftime().
1038+
1039+
Example: "%d/%m/%Y, %H:%M:%S"
1040+
"""
10371041
return _wrap_strftime(self, fmt, self.timetuple())
10381042

10391043
def __format__(self, fmt):

0 commit comments

Comments
 (0)
0