diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2016-08-02 21:49:30 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2016-08-02 21:49:30 (GMT) |
commit | 43746c37704861947179185b4c037e5f18f89a7c (patch) | |
tree | 3223ce1101db5f782c32888e83e64bae66290d09 /Doc/library/datetime.rst | |
parent | 711120d8fd0445b33655101d72b0f576646bff9f (diff) | |
download | cpython-43746c37704861947179185b4c037e5f18f89a7c.zip cpython-43746c37704861947179185b4c037e5f18f89a7c.tar.gz cpython-43746c37704861947179185b4c037e5f18f89a7c.tar.bz2 |
Closes #27661: Added tzinfo keyword argument to datetime.combine.
Diffstat (limited to 'Doc/library/datetime.rst')
-rw-r--r-- | Doc/library/datetime.rst | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index cd78750..a286fbe 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -794,16 +794,23 @@ Other constructors, all class methods: microsecond of the result are all 0, and :attr:`.tzinfo` is ``None``. -.. classmethod:: datetime.combine(date, time) +.. classmethod:: datetime.combine(date, time[, tzinfo]) Return a new :class:`.datetime` object whose date components are equal to the - given :class:`date` object's, and whose time components and :attr:`.tzinfo` - attributes are equal to the given :class:`.time` object's. For any - :class:`.datetime` object *d*, - ``d == datetime.combine(d.date(), d.timetz())``. If date is a + given :class:`date` object's, and whose time components + are equal to the given :class:`.time` object's. If the *tzinfo* + argument is provided, its value is used to set the :attr:`.tzinfo` attribute + of the result, otherwise the :attr:`~.time.tzinfo` attribute of the *time* argument + is used. + + For any :class:`.datetime` object *d*, + ``d == datetime.combine(d.date(), d.time(), d.tzinfo)``. If date is a :class:`.datetime` object, its time components and :attr:`.tzinfo` attributes are ignored. + .. versionchanged:: 3.6 + Added the *tzinfo* argument. + .. classmethod:: datetime.strptime(date_string, format) |