> I use datetime class in my program and now > I have two fields that have the datetime format like this > datetime.datetime(2006, 5, 24, 16, 1, 26)
> How can I find out the date/time difference ( in days) of such two > fields? Hi Lad, you could do this: >>> a = datetime.datetime(2006, 5, 24, 16, 1, 26) >>> b = datetime.datetime(2006, 5, 20, 12, 1, 26) >>> a-b datetime.timedelta(4) # 4 days >>> b = datetime.datetime(2006, 5, 20, 12, 1, 26) >>> x = a-b >>> x datetime.timedelta(4, 14400) >>> str(x) '4 days, 4:00:00' Regards, Nico -- http://mail.python.org/mailman/listinfo/python-list