]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-98378: Add small format string example to strftime comments (GH-98379)
authorAlex Zvorygin <grafetu@gmail.com>
Tue, 18 Oct 2022 13:42:10 +0000 (06:42 -0700)
committerGitHub <noreply@github.com>
Tue, 18 Oct 2022 13:42:10 +0000 (06:42 -0700)
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
Lib/datetime.py

index 007114ae622031327b57b51180747f24a9925871..01742680a95bb66204d377d9e7878ec6a911cee1 100644 (file)
@@ -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):