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
Closed
Changes from all commits
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
7 changes: 6 additions & 1 deletion 7 Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,8 @@ Other constructors, all class methods:
If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` subclass, and the
current date and time are converted to *tz*’s time zone. In this case the
result is equivalent to ``tz.fromutc(datetime.utcnow().replace(tzinfo=tz))``.
It is recommended to create aware datetime object for current UTC time by

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Am not a native english speaker but shouldn't this "It is recommended to create aware datetime object " be "It is recommended to create an aware datetime object for current" or "be "It is recommended to create aware datetime objects for current"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Am not a native english speaker neither but I'd propose:

The recommended way to create aware datetime object for the current time in UTC is ...

calling ``datetime.now(timezone.utc)``.
See also :meth:`today`, :meth:`utcnow`.


Expand Down Expand Up @@ -1134,7 +1136,10 @@ Instance methods:
of the result is set according to the :meth:`dst` method: :attr:`.tzinfo` is
``None`` or :meth:`dst` returns ``None``, :attr:`tm_isdst` is set to ``-1``;
else if :meth:`dst` returns a non-zero value, :attr:`tm_isdst` is set to ``1``;
else :attr:`tm_isdst` is set to ``0``.
else :attr:`tm_isdst` is set to ``0``. To obtain UTC timetuple, it is
recommended to use ``datetime.astimezone(timezone.utc).timetuple()`` because
unlike :meth:`utctimetuple` method, :meth:`timetuple` method does not force
:attr:`tm_isdst` to ``0``.


.. method:: datetime.utctimetuple()
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.