I have a list that contains dates as a string:
date_list = [['4272', '07/18/2022'], ['4271', '07/18/2022'], ['4254', '06/23/2022'], ['4222', '05/09/2022'], ['4174', '03/09/2022'], ['3946', '06/07/2021'], ['3918', '05/03/2021'], ['3914', '08/19/2021'], ['3907', '08/19/2021'], ['3888', '07/05/2022'], ['3784', '12/21/2020'], ['3651', '05/07/2020'], ['3644', '04/20/2020'], ['3615', '02/06/2020'], ['3140', '09/24/2018'], ['3125', '03/03/2022']]
The plan is to use datetime() to compare these dates with today's date and I'll return the output. Obviously for each item in the list, the first value is a unique ID number and the second value is the date. I'm not sure how to pull out the date from each item and re-format it so it can be used with datetime(). Using the first item in my list as an example, I need it to go from the string '07/18/2022' into the function as valid_date = datetime.date(2022,07,18) as ints, so it can run. I have to iterate through each date in my list and run it through datetime()
today = datetime.date.today()
valid_date = datetime.date(<year>,<month>,<day>)
diff = valid_date - today