datetime minus timedelta code example
Example 1: python today - 1 day
from datetime import datetime, timedelta
yesterday = datetime.today() - timedelta(days = 1 )
Example 2: 1 day ago python datetime
date_N_days_ago = datetime.now() - timedelta(days=N)