To find out how many days or more it was given a time width, we did the following:
test.py
import datetime
oneday = datetime.timedelta(days = 1)
delta = datetime.timedelta(minutes = 3000)
print delta // oneday
Looking at the reference, I thought I could go with this, but an error.
TypeError: unsupported operand type(s) for //: 'datetime.timedelta' and 'datetime.timedelta'
It was solved by using the total_seconds method added from 2.7 series.
test.py
import datetime
oneday = datetime.timedelta(days = 1)
delta = datetime.timedelta(minutes = 3000)
print delta.total_seconds() // oneday.total_seconds()
In the 3.x system, it passes from the beginning, so I wonder if division was added from 3.
Recommended Posts