I use the next code:
Code: Select all
from datetime import datetime
s1 = '21:07'
s2 = '21:16'
delta = datetime.strptime(s2, '%H:%M') - datetime.strptime(s1, '%H:%M')
if (delta.minutes > 5):
print "> 5 minuten"
Traceback (most recent call last):
File "thermostaat.py", line 435, in <module>
if (delta.minutes > 5):
AttributeError: 'datetime.timedelta' object has no attribute 'minutes'
What am I doing wrong.?
What is the good way to check?
Please give a good example
Help is apriciated