Re: [Tutor] Use of dateutil.relativedata

2006-11-15 Thread Etrade Griffiths
Sorry, problem solved

import datetime
import dateutil.relativedelta

x=datetime.date.today()
y=x+datetime.timedelta(days=366)
z=y-x

print x,y,z

a=dateutil.relativedelta.relativedelta(x,y)
print a

seems to do the trick


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Use of dateutil.relativedata

2006-11-15 Thread Etrade Griffiths
Hi

trying to use dateutil to calculate the number of months between two 
dates.  here is the script

import datetime
import dateutil

x=datetime.date.today()
y=x+datetime.timedelta(days=366)
z=y-x

print x,y,z

a=dateutil.relativedelta(x,y)
print a


and here is the output

 >>>
2006-11-15 2007-11-16 366 days, 0:00:00

Traceback (most recent call last):
   File "C:/Projects/completion_dates", line 10, in -toplevel-
 a=dateutil.relativedelta(x,y)
AttributeError: 'module' object has no attribute 'relativedelta'
 >>>

There's problem here that's really basic but just can't see it!!!

Thanks

Alun Griffiths 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor