Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a link to the strtime() and strptime() behaviour
  • Loading branch information
matrixise committed Mar 22, 2019
commit 4c4a7cc09f541d66cf040b948acbb8a366c2e123
8 changes: 5 additions & 3 deletions Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,8 @@ Other constructors, all class methods:
Return a :class:`date` corresponding to *date_string*, parsed according to
*format*. :exc:`ValueError` is raised if the date string and format can't be
parsed by :meth:`time.strptime`, or if time components are present in the
format string.
format string. For a complete list of formatting directives, see
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps clarify “time.strptime” does not refer to the strptime function in the time module. The reader may not see the meth RST code, HTML links, etc.

:ref:`strftime-strptime-behavior`.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add something like "For a complete list of formatting directives, see strftime() and strptime() Behavior." with a link? (copy the sentence from datetime.datetime.strptime) Just from this doc, I have no idea of what is the expected format.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

.. versionadded:: 3.8

Expand Down Expand Up @@ -1441,8 +1442,9 @@ Other constructors, all class methods:

Return a :class:`time` corresponding to *date_string, parsed according to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why `time` here, but `.time` below (with a dot)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 and there was an other erorr with *date_string*

*format*. :exc:`ValueError` is raised if the date string and format can't be
parsed by :meth:`time.strptime`, if it returns a value which isn't a time tuple,
or if the date part is nonzero.
parsed by :meth:`time.strptime`, if it returns a value which isn't a time
tuple, or if the date part is nonzero. For a complete list of formatting
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“By time.strptime” is redundant, unless you mean to refer to the strptime function in the time module.

What does “the date part is nonzero” mean? I would expect the time class to work without specifying a date, zero or otherwise.

directives, see :ref:`strftime-strptime-behavior`.

.. versionadded:: 3.8

Expand Down