8000 [3.11] gh-98378: Add small format string example to strftime comments… · python/cpython@9713cac · GitHub
[go: up one dir, main page]

Skip to content

Commit 9713cac

Browse files
miss-islingtonzvoryAlexWaygood
authored
[3.11] gh-98378: Add small format string example to strftime comments (GH-98379) (#98395)
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 8000 docs on the python docs before they get to the actual [definition here](https://docs.python.org/3/library/datetime.htmlGH-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 (cherry picked from commit 6ccca69) Co-authored-by: Alex Zvorygin <grafetu@gmail.com> Co-authored-by: Alex Zvorygin <grafetu@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
1 parent 3cd39e9 commit 9713cac

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
@@ -1030,7 +1030,11 @@ def ctime(self):
10301030
self._day, self._year)
10311031

10321032
def strftime(self, fmt):
1033-
"Format using strftime()."
1033+
"""
1034+
Format using strftime().
1035+
1036+
Example: "%d/%m/%Y, %H:%M:%S"
1037+
"""
10341038
return _wrap_strftime(self, fmt, self.timetuple())
10351039

10361040
def __format__(self, fmt):

0 commit comments

Comments
 (0)
0