Code

add more doc to date.py
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Tue, 6 Apr 2004 21:56:10 +0000 (21:56 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Tue, 6 Apr 2004 21:56:10 +0000 (21:56 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2259 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/date.py

index a8d6ef3b09817ea0963c0663e806a09eb0dfa5f5..8d84c6ff505642f4faca7fd93f3e8e183b352d6b 100644 (file)
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: date.py,v 1.63 2004-03-24 04:57:25 richard Exp $
+# $Id: date.py,v 1.64 2004-04-06 21:56:10 richard Exp $
 
 """Date, time and time interval handling.
 """
 
 """Date, time and time interval handling.
 """
@@ -90,6 +90,22 @@ class Date:
     The date format 'yyyymmddHHMMSS' (year, month, day, hour,
     minute, second) is the serialisation format returned by the serialise()
     method, and is accepted as an argument on instatiation.
     The date format 'yyyymmddHHMMSS' (year, month, day, hour,
     minute, second) is the serialisation format returned by the serialise()
     method, and is accepted as an argument on instatiation.
+
+    The date class handles basic arithmetic::
+
+        >>> d1=Date('.')
+        >>> d1
+        <Date 2004-04-06.22:04:20.766830>
+        >>> d2=Date('2003-07-01')
+        >>> d2
+        <Date 2003-07-01.00:00:0.000000>
+        >>> d1-d2
+        <Interval + 280d 22:04:20>
+        >>> i1=_
+        >>> d2+i1
+        <Date 2004-04-06.22:04:20.000000>
+        >>> d1-i1
+        <Date 2003-07-01.00:00:0.000000>
     '''
     
     def __init__(self, spec='.', offset=0, add_granularity=0):
     '''
     
     def __init__(self, spec='.', offset=0, add_granularity=0):