[EMAIL PROTECTED] wrote: > Hey there, > i am doing a plotting application. > i am using mxRelativeDateTimeDiff to get how much time is between > date x and date y > > now what i need to do is divide that time by 20 to get 20 even time > slots > for plotting on a graph. > > For example, if the difference between them is 20 hours, i need 20 > plots, each an hour apart. if its 40 minutes, i need 20 plots that are > 2 minutes apart. > > what would be a way i could pull this off? > > thanks > C:\Steve\Projects\Python>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import mx.DateTime as dt >>> d1 = dt.DateTime(2005, 1, 1) >>> d2 = dt.DateTime(2005, 1, 21) >>> rdt = dt.RelativeDateTimeDiff(d2, d1) >>> rdt <RelativeDateTime instance for 'YYYY-MM-(+20) HH:MM:SS' at 0x9f1300> >>> rdt/20 <RelativeDateTime instance for 'YYYY-MM-(+01) HH:MM:SS' at 0x9d5e90> >>> for i in range(20): ... print dt.DateTime(2000) + i*(rdt/20) ... C:\Python24\lib\site-packages\mx\DateTime\DateTime.py:585: DeprecationWarning: i nteger argument expected, got float return DateTime(year, month, 1) + \ 2000-01-01 00:00:00.00 2000-01-02 00:00:00.00 2000-01-03 00:00:00.00 2000-01-04 00:00:00.00 2000-01-05 00:00:00.00 2000-01-06 00:00:00.00 2000-01-07 00:00:00.00 2000-01-08 00:00:00.00 2000-01-09 00:00:00.00 2000-01-10 00:00:00.00 2000-01-11 00:00:00.00 2000-01-12 00:00:00.00 2000-01-13 00:00:00.00 2000-01-14 00:00:00.00 2000-01-15 00:00:00.00 2000-01-16 00:00:00.00 2000-01-17 00:00:00.00 2000-01-18 00:00:00.00 2000-01-19 00:00:00.00 2000-01-20 00:00:00.00 >>>
Does this help? regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.pycon.org -- http://mail.python.org/mailman/listinfo/python-list