import datetime
start = datetime.datetime(2009, 1, 31)
end = datetime.datetime(2009, 2, 1)
print end-start
>>1 day, 0:00:00//output
How to get the output in minutes
Thanks,
import datetime
start = datetime.datetime(2009, 1, 31)
end = datetime.datetime(2009, 2, 1)
print end-start
>>1 day, 0:00:00//output
How to get the output in minutes
Thanks,
import datetime
start = datetime.datetime(2009, 1, 31)
end = datetime.datetime(2009, 2, 1)
diff = end-start
print (diff.days * 1440) + (diff.seconds / 60)
>> 1440.0
(I'm assuming you don't need microsecond resolution here - but if you do, just add in a third term using diff.microseconds
with the proper divisor to convert to minutes.)