date1 = datetime.datetime(2012, 10, 10, 10, 15, 44)
date2 = datetime.datetime(2012, 10, 17, 8, 45, 38)
roundedA = date2.replace(second = 0, microsecond = 0)
print roundedA
roundedB = date1.replace(second = 0, microsecond = 0)
print roundedB
minutes = (roundedA - roundedB).min
print minutes
结果是:
-999999999 days, 0:00:00
我想计算 2 个不同的日期差异。我在上面减去了,但它并没有给我想要的东西。如何减去两个日期并在几分钟或几小时内得到结果。