python get date 5 days ago 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)
Example 3: python datetime get date one week from today
>>> import datetime
>>> datetime.datetime.now() + datetime.timedelta(days=7)