When you subtract two datetime objects in python, you get a datetime.timedelta object. You can then get the total_seconds()
for that timedelta object and check if that is greater than 3*3600
, which is the number of seconds for 3 hours. Example -
>>> a = datetime.datetime.now()
>>> b = datetime.datetime(2015,8,25,0,0,0,0)
>>> c = a - b
>>> c.total_seconds()
87062.729491
>>> c.total_seconds() > 3*3600
True