Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-85453: Adapt datetime.rst to devguide recommendations for code snippets and variables #118068

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Apr 24, 2024
Merged
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
Updates based on PR review
  • Loading branch information
uatach committed Apr 24, 2024
commit 4924fd0ccc76a8c82742512062c1f3434bcc47c1
26 changes: 13 additions & 13 deletions 26 Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
| Operation | Result |
+================================+===============================================+
| ``t1 = t2 + t3`` | Sum of ``t2`` and ``t3``. Afterwards ``t1 - t2|
| | == t3`` and ``t1 - t3 == t2`` are true. (1) |

Check warning on line 306 in Doc/library/datetime.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Inline literal start-string without end-string.
+--------------------------------+-----------------------------------------------+
| ``t1 = t2 - t3`` | Difference of ``t2`` and ``t3``. Afterwards |
| | ``t1 == t2 - t3`` and ``t2 == t1 + t3`` are |
Expand Down Expand Up @@ -569,12 +569,12 @@

.. attribute:: date.month

Between ``1`` and ``12`` inclusive.
Between 1 and 12 inclusive.


.. attribute:: date.day

Between ``1`` and the number of days in the given month of the given year.
Between 1 and the number of days in the given month of the given year.


Supported operations:
Expand Down Expand Up @@ -676,20 +676,20 @@
.. method:: date.toordinal()

Return the proleptic Gregorian ordinal of the date, where January 1 of year 1
has ordinal ``1``. For any :class:`date` object *d*,
has ordinal 1. For any :class:`date` object *d*,
``date.fromordinal(d.toordinal()) == d``.


.. method:: date.weekday()

Return the day of the week as an integer, where Monday is ``0`` and Sunday is ``6``.
Return the day of the week as an integer, where Monday is 0 and Sunday is 6.
For example, ``date(2002, 12, 4).weekday() == 2``, a Wednesday. See also
:meth:`isoweekday`.


.. method:: date.isoweekday()

Return the day of the week as an integer, where Monday is ``1`` and Sunday is ``7``.
Return the day of the week as an integer, where Monday is 1 and Sunday is 7.
For example, ``date(2002, 12, 4).isoweekday() == 3``, a Wednesday. See also
:meth:`weekday`, :meth:`isocalendar`.

Expand Down Expand Up @@ -840,7 +840,7 @@

Like a :class:`date` object, :class:`.datetime` assumes the current Gregorian
calendar extended in both directions; like a :class:`.time` object,
:class:`.datetime` assumes there are exactly ``3600 * 24`` seconds in every day.
:class:`.datetime` assumes there are exactly ``3600*24`` seconds in every day.
JelleZijlstra marked this conversation as resolved.
Show resolved Hide resolved

Constructor:

Expand Down Expand Up @@ -1127,12 +1127,12 @@

.. attribute:: datetime.month

Between ``1`` and ``12`` inclusive.
Between 1 and 12 inclusive.


.. attribute:: datetime.day

Between ``1`` and the number of days in the given month of the given year.
Between 1 and the number of days in the given month of the given year.


.. attribute:: datetime.hour
Expand Down Expand Up @@ -1166,7 +1166,7 @@
In ``[0, 1]``. Used to disambiguate wall times during a repeated interval. (A
repeated interval occurs when clocks are rolled back at the end of daylight saving
time or when the UTC offset for the current zone is decreased for political reasons.)
The value ``0`` (1) represents the earlier (later) of the two moments with the same wall
The value ``0`` (``1``) represents the earlier (later) of the two moments with the same wall
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved
time representation.

.. versionadded:: 3.6
Expand All @@ -1192,7 +1192,7 @@
+---------------------------------------+--------------------------------+

(1)
datetime2 is a duration of timedelta removed from datetime1, moving forward in
``datetime2`` is a duration of timedelta removed from ``datetime1``, moving forward in
serhiy-storchaka marked this conversation as resolved.
Show resolved Hide resolved
time if ``timedelta.days > 0``, or backward if ``timedelta.days < 0``. The
result has the same :attr:`~.datetime.tzinfo` attribute as the input datetime, and
``datetime2 - datetime1 == timedelta`` after. :exc:`OverflowError` is raised if
Expand Down Expand Up @@ -1461,13 +1461,13 @@

.. method:: datetime.weekday()

Return the day of the week as an integer, where Monday is ``0`` and Sunday is ``6``.
Return the day of the week as an integer, where Monday is 0 and Sunday is 6.
The same as ``self.date().weekday()``. See also :meth:`isoweekday`.


.. method:: datetime.isoweekday()

Return the day of the week as an integer, where Monday is ``1`` and Sunday is ``7``.
Return the day of the week as an integer, where Monday is 1 and Sunday is 7.
The same as ``self.date().isoweekday()``. See also :meth:`weekday`,
:meth:`isocalendar`.

Expand All @@ -1489,7 +1489,7 @@
appended, giving the UTC offset:

- ``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond`
is not 0
is not ``0``
- ``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is ``0``

Examples::
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.