datetime day 1 to 7 code example
Example 1: python today - 1 day
from datetime import datetime, timedelta
yesterday = datetime.today() - timedelta(days = 1 )
Example 2: datetime decreasing date python
from datetime import datetime, timedelta
d = datetime.today() - timedelta(days=days_to_subtract)