@@ -737,18 +737,16 @@ Instance methods:
737737.. method :: date.strftime(format)
738738
739739 Return a string representing the date, controlled by an explicit format string.
740- Format codes referring to hours, minutes or seconds will see 0 values. For a
741- complete list of formatting directives, see
742- :ref: `strftime-strptime-behavior `.
740+ Format codes referring to hours, minutes or seconds will see 0 values.
741+ See also :ref: `strftime-strptime-behavior ` and :meth: `date.isoformat `.
743742
744743
745744.. method :: date.__format__(format)
746745
747746 Same as :meth: `.date.strftime `. This makes it possible to specify a format
748747 string for a :class: `.date ` object in :ref: `formatted string
749- literals <f-strings>` and when using :meth: `str.format `. For a
750- complete list of formatting directives, see
751- :ref: `strftime-strptime-behavior `.
748+ literals <f-strings>` and when using :meth: `str.format `.
749+ See also :ref: `strftime-strptime-behavior ` and :meth: `date.isoformat `.
752750
753751Examples of Usage: :class: `date `
754752^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1051,8 +1049,8 @@ Other constructors, all class methods:
10511049
10521050 :exc: `ValueError ` is raised if the date_string and format
10531051 can't be parsed by :func: `time.strptime ` or if it returns a value which isn't a
1054- time tuple. For a complete list of formatting directives, see
1055- :ref: ` strftime-strptime-behavior `.
1052+ time tuple. See also :ref: ` strftime-strptime-behavior ` and
1053+ :meth: ` datetime.fromisoformat `.
10561054
10571055
10581056
@@ -1510,20 +1508,21 @@ Instance methods:
15101508 (which :func: `time.ctime ` invokes, but which
15111509 :meth: `datetime.ctime ` does not invoke) conforms to the C standard.
15121510
1511+
15131512.. method :: datetime.strftime(format)
15141513
1515- Return a string representing the date and time, controlled by an explicit format
1516- string. For a complete list of formatting directives, see
1517- :ref: `strftime-strptime-behavior `.
1514+ Return a string representing the date and time,
1515+ controlled by an explicit format string.
1516+ See also :ref: `strftime-strptime-behavior ` and :meth: ` datetime.isoformat `.
15181517
15191518
15201519.. method :: datetime.__format__(format)
15211520
15221521 Same as :meth: `.datetime.strftime `. This makes it possible to specify a format
15231522 string for a :class: `.datetime ` object in :ref: `formatted string
1524- literals <f-strings>` and when using :meth: `str.format `. For a
1525- complete list of formatting directives, see
1526- :ref: ` strftime-strptime-behavior `.
1523+ literals <f-strings>` and when using :meth: `str.format `.
1524+ See also :ref: ` strftime-strptime-behavior ` and :meth: ` datetime.isoformat `.
1525+
15271526
15281527Examples of Usage: :class: `.datetime `
15291528^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1868,17 +1867,15 @@ Instance methods:
18681867.. method :: time.strftime(format)
18691868
18701869 Return a string representing the time, controlled by an explicit format
1871- string. For a complete list of formatting directives, see
1872- :ref: `strftime-strptime-behavior `.
1870+ string. See also :ref: `strftime-strptime-behavior ` and :meth: `time.isoformat `.
18731871
18741872
18751873.. method :: time.__format__(format)
18761874
1877- Same as :meth: `.time.strftime `. This makes it possible to specify a format string
1878- for a :class: `.time ` object in :ref: `formatted string
1879- literals <f-strings>` and when using :meth: `str.format `. For a
1880- complete list of formatting directives, see
1881- :ref: `strftime-strptime-behavior `.
1875+ Same as :meth: `.time.strftime `. This makes it possible to specify
1876+ a format string for a :class: `.time ` object in :ref: `formatted string
1877+ literals <f-strings>` and when using :meth: `str.format `.
1878+ See also :ref: `strftime-strptime-behavior ` and :meth: `time.isoformat `.
18821879
18831880
18841881.. method :: time.utcoffset()
@@ -2320,6 +2317,14 @@ versus :meth:`strptime`:
23202317:meth: `strftime ` and :meth: `strptime ` Format Codes
23212318^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23222319
2320+ These methods accept format codes that can be used to parse and format dates::
2321+
2322+ >>> datetime.strptime('31/01/22 23:59:59.999999',
2323+ ... '%d/%m/%y %H:%M:%S.%f')
2324+ datetime.datetime(2022, 1, 31, 23, 59, 59, 999999)
2325+ >>> _.strftime('%a %d %b %Y, %I:%M%p')
2326+ 'Mon 31 Jan 2022, 11:59PM'
2327+
23232328The following is a list of all the format codes that the 1989 C standard
23242329requires, and these work on all platforms with a standard C implementation.
23252330
0 commit comments