From 9d59c3a324a6474690ea49a11cd1e1dce48de310 Mon Sep 17 00:00:00 2001 From: PlayfulPiano Date: Thu, 10 Apr 2025 15:24:46 -0400 Subject: [PATCH] Add hyperlink to format code information for strftime() and strptime() --- Lib/_pydatetime.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Lib/_pydatetime.py b/Lib/_pydatetime.py index 50e21a12335611..4b03ad313ddc25 100644 --- a/Lib/_pydatetime.py +++ b/Lib/_pydatetime.py @@ -1107,6 +1107,8 @@ def strftime(self, format): Format using strftime(). Example: "%d/%m/%Y, %H:%M:%S" + + `A list of supported format codes can be viewed here. `_ """ return _wrap_strftime(self, format, self.timetuple()) @@ -1636,6 +1638,8 @@ def fromisoformat(cls, time_string): def strftime(self, format): """Format using strftime(). The date part of the timestamp passed to underlying strftime should not be used. + + `A list of supported format codes can be viewed here. `_ """ # The year must be >= 1000 else Python's strftime implementation # can raise a bogus exception. @@ -2180,7 +2184,9 @@ def __str__(self): @classmethod def strptime(cls, date_string, format): - 'string, format -> new datetime parsed from a string (like time.strptime()).' + """string, format -> new datetime parsed from a string (like time.strptime()). + + `A list of supported format codes can be viewed here. `_""" import _strptime return _strptime._strptime_datetime_datetime(cls, date_string, format)