Skip to content
Merged
Show file tree
Hide file tree
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
Update docs on new %z behaviour
  • Loading branch information
mariocj89 committed Oct 25, 2017
commit c20b57fcdda9f43f69ff46beddedd1231920dad3
9 changes: 5 additions & 4 deletions Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2175,10 +2175,11 @@ Notes:
The UTC offset is not restricted to a whole number of minutes.

.. versionchanged:: 3.7
When ``%z`` directive is provided to the :meth:`strptime` method, any valid
RFC-822/ISO 8601 standard utftime-offset can be parsed. For example, strings
like ``'+01:00'`` will be parsed as an offset of one hour and or ``'Z'`` will
be transofmred to a 0 UTC offset.
When the ``%z`` directive is provided to the :meth:`strptime` method,
the UTC offsets can have a colon as a separator between hours, minutes
and seconds.
For example, ``'+01:00:00'`` will be parsed as an offset of one hour.
In addition, providing ``'Z'`` is identical to ``'+00:00'``.

``%Z``
If :meth:`tzname` returns ``None``, ``%Z`` is replaced by an empty
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Add support for parsing RFC-822/ISO 8601 UTC offsets. strptime '%z' can now
Extended support for parsing UTC offsets. strptime '%z' can now
parse the output generated by datetime.isoformat, including seconds and
microseconds.