diff options
author | Alex Zvorygin <grafetu@gmail.com> | 2022-10-18 13:42:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-18 13:42:10 (GMT) |
commit | 6ccca69d0d313135b2fbb2aa92c69c315be779c6 (patch) | |
tree | 5627ccca9ee1b925584ee49625e17033596abf94 /Lib/datetime.py | |
parent | 0bbea545e35d17b10ea95d0d10f34e9b5a4e6c53 (diff) | |
download | cpython-6ccca69d0d313135b2fbb2aa92c69c315be779c6.zip cpython-6ccca69d0d313135b2fbb2aa92c69c315be779c6.tar.gz cpython-6ccca69d0d313135b2fbb2aa92c69c315be779c6.tar.bz2 |
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
Diffstat (limited to 'Lib/datetime.py')
-rw-r--r-- | Lib/datetime.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/datetime.py b/Lib/datetime.py index 007114a..0174268 100644 --- a/Lib/datetime.py +++ b/Lib/datetime.py @@ -1033,7 +1033,11 @@ class date: self._day, self._year) def strftime(self, fmt): - "Format using strftime()." + """ + Format using strftime(). + + Example: "%d/%m/%Y, %H:%M:%S" + """ return _wrap_strftime(self, fmt, self.timetuple()) def __format__(self, fmt): |