import datetime
# Get the current time
today = datetime.datetime.now()
# Day of the week
week_day=datetime.date.isoweekday(today)
# Calculate the offset Minus weeks
now_offset = datetime.timedelta(days=-week_day)
# Three day offset
day_offset_3=datetime.timedelta(days=-3)
# Three days ago
day_before_3=(today + now_offset).strftime('%Y-%m-%d')
# Return to last year's time
year_offset = datetime.timedelta(days=(-365-week_day))
# Get the time of the desired date
now_time=(today + now_offset).strftime('%Y-%m-%d')
# Return to last year's date
year_time = (today + year_offset).strftime('%Y-%m-%d')