summaryrefslogtreecommitdiffstats
path: root/Doc/library/datetime.rst
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-06-08 18:59:20 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-06-08 18:59:20 (GMT)
commit649124856aa994629e574c7a7ecf22d3b07f3ca0 (patch)
tree5bc9a6959e9e6865fe40b6dbb6778f627b16cd70 /Doc/library/datetime.rst
parent9dd47b891de007b09d03230a17ba2b7aed892c8c (diff)
downloadcpython-649124856aa994629e574c7a7ecf22d3b07f3ca0.zip
cpython-649124856aa994629e574c7a7ecf22d3b07f3ca0.tar.gz
cpython-649124856aa994629e574c7a7ecf22d3b07f3ca0.tar.bz2
Merged revisions 81489 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81489 | georg.brandl | 2010-05-23 17:29:29 -0400 (Sun, 23 May 2010) | 1 line #1436346: make it more obvious that timetuple[7] is yday. ........
Diffstat (limited to 'Doc/library/datetime.rst')
-rw-r--r--Doc/library/datetime.rst17
1 files changed, 10 insertions, 7 deletions
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
index 2a90e42..2498361 100644
--- a/Doc/library/datetime.rst
+++ b/Doc/library/datetime.rst
@@ -480,7 +480,9 @@ Instance methods:
Return a :class:`time.struct_time` such as returned by :func:`time.localtime`.
The hours, minutes and seconds are 0, and the DST flag is -1. ``d.timetuple()``
is equivalent to ``time.struct_time((d.year, d.month, d.day, 0, 0, 0,
- d.weekday(), d.toordinal() - date(d.year, 1, 1).toordinal() + 1, -1))``
+ d.weekday(), yday, -1))``, where ``yday = d.toordinal() - date(d.year, 1,
+ 1).toordinal() + 1`` is the day number within the current year starting with
+ ``1`` for January 1st.
.. method:: date.toordinal()
@@ -944,12 +946,13 @@ Instance methods:
Return a :class:`time.struct_time` such as returned by :func:`time.localtime`.
``d.timetuple()`` is equivalent to ``time.struct_time((d.year, d.month, d.day,
- d.hour, d.minute, d.second, d.weekday(), d.toordinal() - date(d.year, 1,
- 1).toordinal() + 1, dst))`` The :attr:`tm_isdst` flag 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 ``tm_isdst`` is
- set to ``0``.
+ d.hour, d.minute, d.second, d.weekday(), yday, dst))``, where ``yday =
+ d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the day number within
+ the current year starting with ``1`` for January 1st. The :attr:`tm_isdst` flag
+ 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 ``tm_isdst`` is set to ``0``.
.. method:: datetime.utctimetuple()