I am sure this is probably a simple syntax fix but I receive invalid syntax errors during the Select Analysis when trying to select records where the date field in my file geodb (ISS_CST) is greater than the date variable. I have tried a couple different lines but they do not work.
dayDateStr = '120521''120621'
dayDate10DaysAgo = datetime.datetime.strptime(dayDateStr, "%m%d%y") - timedelta(days=10)
print (dayDate10DaysAgo)
#arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo)
arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"")
>> 2021-11-26 00:00:00
File "weatherloader_Test_Warnings.py", line 279, in ProcessWarnings arcpy.Select_analysis(warningsSel2, warningsSel2a, "ISS_CST > date" +dayDate10DaysAgo+"") TypeError: cannot concatenate 'str' and 'datetime.datetime' objects
If I use the line currently commented out the error is:
File "weatherloader_Test_Warnings.py", line 278 arcpy.Select_analysis(warningsSel2, warningsSel2a, "!ISS_CST! >" dayDate10DaysAgo) ^ SyntaxError: invalid syntax