diff options
author | Georg Brandl <georg@python.org> | 2009-01-03 21:18:54 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-01-03 21:18:54 (GMT) |
commit | 48310cd3f2e02ced9ae836ccbcb67e9af3097d62 (patch) | |
tree | 04c86b387c11bfd4835a320e76bbb2ee24626e0d /Doc/library/datetime.rst | |
parent | 3d3558a4653fcfcbdcbb75bda5d61e93c48f4d51 (diff) | |
download | cpython-48310cd3f2e02ced9ae836ccbcb67e9af3097d62.zip cpython-48310cd3f2e02ced9ae836ccbcb67e9af3097d62.tar.gz cpython-48310cd3f2e02ced9ae836ccbcb67e9af3097d62.tar.bz2 |
Remove trailing whitespace.
Diffstat (limited to 'Doc/library/datetime.rst')
-rw-r--r-- | Doc/library/datetime.rst | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 9401b38..c37ceb9 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -264,10 +264,10 @@ efficient pickling, and in Boolean contexts, a :class:`timedelta` object is considered to be true if and only if it isn't equal to ``timedelta(0)``. Example usage: - + >>> from datetime import timedelta >>> year = timedelta(days=365) - >>> another_year = timedelta(weeks=40, days=84, hours=23, + >>> another_year = timedelta(weeks=40, days=84, hours=23, ... minutes=50, seconds=600) # adds up to 365 days >>> year == another_year True @@ -515,10 +515,10 @@ Example of counting days to an event:: True >>> my_birthday = date(today.year, 6, 24) >>> if my_birthday < today: - ... my_birthday = my_birthday.replace(year=today.year + 1) + ... my_birthday = my_birthday.replace(year=today.year + 1) >>> my_birthday datetime.date(2008, 6, 24) - >>> time_to_birthday = abs(my_birthday - today) + >>> time_to_birthday = abs(my_birthday - today) >>> time_to_birthday.days 202 @@ -1012,7 +1012,7 @@ Examples of working with datetime objects: >>> tt = dt.timetuple() >>> for it in tt: # doctest: +SKIP ... print(it) - ... + ... 2006 # year 11 # month 21 # day @@ -1041,23 +1041,23 @@ Using datetime with tzinfo: ... def __init__(self): # DST starts last Sunday in March ... d = datetime(dt.year, 4, 1) # ends last Sunday in October ... self.dston = d - timedelta(days=d.weekday() + 1) - ... d = datetime(dt.year, 11, 1) + ... d = datetime(dt.year, 11, 1) ... self.dstoff = d - timedelta(days=d.weekday() + 1) ... def utcoffset(self, dt): ... return timedelta(hours=1) + self.dst(dt) - ... def dst(self, dt): + ... def dst(self, dt): ... if self.dston <= dt.replace(tzinfo=None) < self.dstoff: ... return timedelta(hours=1) ... else: ... return timedelta(0) ... def tzname(self,dt): ... return "GMT +1" - ... + ... >>> class GMT2(tzinfo): ... def __init__(self): - ... d = datetime(dt.year, 4, 1) + ... d = datetime(dt.year, 4, 1) ... self.dston = d - timedelta(days=d.weekday() + 1) - ... d = datetime(dt.year, 11, 1) + ... d = datetime(dt.year, 11, 1) ... self.dstoff = d - timedelta(days=d.weekday() + 1) ... def utcoffset(self, dt): ... return timedelta(hours=1) + self.dst(dt) @@ -1068,7 +1068,7 @@ Using datetime with tzinfo: ... return timedelta(0) ... def tzname(self,dt): ... return "GMT +2" - ... + ... >>> gmt1 = GMT1() >>> # Daylight Saving Time >>> dt1 = datetime(2006, 11, 21, 16, 30, tzinfo=gmt1) @@ -1089,7 +1089,7 @@ Using datetime with tzinfo: datetime.datetime(2006, 6, 14, 13, 0, tzinfo=<GMT1 object at 0x...>) >>> dt2.utctimetuple() == dt3.utctimetuple() True - + .. _datetime-time: @@ -1237,12 +1237,12 @@ Instance methods: return ``None`` or a string object. Example: - + >>> from datetime import time, tzinfo >>> class GMT1(tzinfo): ... def utcoffset(self, dt): - ... return timedelta(hours=1) - ... def dst(self, dt): + ... return timedelta(hours=1) + ... def dst(self, dt): ... return timedelta(0) ... def tzname(self,dt): ... return "Europe/Prague" @@ -1473,7 +1473,7 @@ Applications that can't bear such ambiguities should avoid using hybrid :class:`tzinfo` subclasses; there are no ambiguities when using UTC, or any other fixed-offset :class:`tzinfo` subclass (such as a class representing only EST (fixed offset -5 hours), or only EDT (fixed offset -4 hours)). - + .. _strftime-behavior: @@ -1516,7 +1516,7 @@ For an aware object: The full set of format codes supported varies across platforms, because Python calls the platform C library's :func:`strftime` function, and platform -variations are common. +variations are common. The following is a list of all the format codes that the C standard (1989 version) requires, and these work on all platforms with a standard C |