diff options
author | Gus Goulart <augusto@goulart.me> | 2018-10-29 11:49:52 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2018-10-29 11:49:52 (GMT) |
commit | c0799ec973530ad2492bb1d6c7287ffc428f0348 (patch) | |
tree | 23eae01541789702e3509e086aec7a45293b7d9d /Doc/library | |
parent | 53835e92d315340444e3dd083b3f69a590b00e07 (diff) | |
download | cpython-c0799ec973530ad2492bb1d6c7287ffc428f0348.zip cpython-c0799ec973530ad2492bb1d6c7287ffc428f0348.tar.gz cpython-c0799ec973530ad2492bb1d6c7287ffc428f0348.tar.bz2 |
bpo-27741: Better wording for datetime.strptime() (GH-9994)
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/datetime.rst | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index a1a60b0..0363111 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -2016,7 +2016,9 @@ although not all objects support a :meth:`timetuple` method. Conversely, the :meth:`datetime.strptime` class method creates a :class:`.datetime` object from a string representing a date and time and a corresponding format string. ``datetime.strptime(date_string, format)`` is -equivalent to ``datetime(*(time.strptime(date_string, format)[0:6]))``. +equivalent to ``datetime(*(time.strptime(date_string, format)[0:6]))``, except +when the format includes sub-second components or timezone offset information, +which are supported in ``datetime.strptime`` but are discarded by ``time.strptime``. For :class:`.time` objects, the format codes for year, month, and day should not be used, as time objects have no such values. If they're used anyway, ``1900`` |