Skip to content

Commit 9d59c3a

Browse files
authored
Add hyperlink to format code information for strftime() and strptime()
1 parent a214db0 commit 9d59c3a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Lib/_pydatetime.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,8 @@ def strftime(self, format):
11071107
Format using strftime().
11081108
11091109
Example: "%d/%m/%Y, %H:%M:%S"
1110+
1111+
`A list of supported format codes can be viewed here. <https://docs.python.org/3/library/datetime.html#format-codes>`_
11101112
"""
11111113
return _wrap_strftime(self, format, self.timetuple())
11121114

@@ -1636,6 +1638,8 @@ def fromisoformat(cls, time_string):
16361638
def strftime(self, format):
16371639
"""Format using strftime(). The date part of the timestamp passed
16381640
to underlying strftime should not be used.
1641+
1642+
`A list of supported format codes can be viewed here. <https://docs.python.org/3/library/datetime.html#format-codes>`_
16391643
"""
16401644
# The year must be >= 1000 else Python's strftime implementation
16411645
# can raise a bogus exception.
@@ -2180,7 +2184,9 @@ def __str__(self):
21802184

21812185
@classmethod
21822186
def strptime(cls, date_string, format):
2183-
'string, format -> new datetime parsed from a string (like time.strptime()).'
2187+
"""string, format -> new datetime parsed from a string (like time.strptime()).
2188+
2189+
`A list of supported format codes can be viewed here. <https://docs.python.org/3/library/datetime.html#format-codes>`_"""
21842190
import _strptime
21852191
return _strptime._strptime_datetime_datetime(cls, date_string, format)
21862192

0 commit comments

Comments
 (0)