from datetime import datetime, timedelta
now = datetime.now()
print(now)
this_time_yesterday = now - timedelta(hours=24)
print(this_time_yesterday)
(now - this_time_yesterday).days
How do I subtract two dates in Django/Python?