diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2012-06-22 16:23:23 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2012-06-22 16:23:23 (GMT) |
commit | fdc860f3106b59ec908e0b605e51a1607ea2ff4b (patch) | |
tree | 987e362d240fea4f004803dd9fa0dd62b5d35db2 /Doc/library/datetime.rst | |
parent | 8f904daee9dcb6b36b925f184144921e8bf6aaa6 (diff) | |
download | cpython-fdc860f3106b59ec908e0b605e51a1607ea2ff4b.zip cpython-fdc860f3106b59ec908e0b605e51a1607ea2ff4b.tar.gz cpython-fdc860f3106b59ec908e0b605e51a1607ea2ff4b.tar.bz2 |
Issue #9527: datetime.astimezone() method will now supply a class
timezone instance corresponding to the system local timezone when
called with no arguments.
Diffstat (limited to 'Doc/library/datetime.rst')
-rw-r--r-- | Doc/library/datetime.rst | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 5c2d3d9..85bbb89 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -958,17 +958,22 @@ Instance methods: datetime with no conversion of date and time data. -.. method:: datetime.astimezone(tz) +.. method:: datetime.astimezone(tz=None) - Return a :class:`.datetime` object with new :attr:`tzinfo` attribute *tz*, + Return a :class:`datetime` object with new :attr:`tzinfo` attribute *tz*, adjusting the date and time data so the result is the same UTC time as *self*, but in *tz*'s local time. - *tz* must be an instance of a :class:`tzinfo` subclass, and its + If provided, *tz* must be an instance of a :class:`tzinfo` subclass, and its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. *self* must be aware (``self.tzinfo`` must not be ``None``, and ``self.utcoffset()`` must not return ``None``). + If called without arguments (or with ``tz=None``) the system local + timezone is assumed. The ``tzinfo`` attribute of the converted + datetime instance will be set to an instance of :class:`timezone` + with the zone name and offset obtained from the OS. + If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no adjustment of date or time data is performed. Else the result is local time in time zone *tz*, representing the same UTC time as *self*: after |