The formula that you’re using isn’t valid for several reasons:
- Dates written in strings are still strings, not dates. The
DATETIME_PARSE()
function is required to take a date string and turn it into an actual datetime (the data type used internally by Airtable for date comparisons and calculations)
- Even if strings could become dates without that function, you’re currently taking the last modified time and trying to add it to another date, which isn’t a valid date operation.
- The
IS_AFTER()
function requires two arguments, but you’re only passing one (the invalid date sum mentioned previously)
- This isn’t technically a problem, but just an inefficiency: because you used single quotes to surround your formula string, you shouldn’t need to escape the double quotes inside it.
My gut says that you want to compare the record’s last modified time against that static date in the string. First let’s turn that date string into an actual datetime:
DATETIME_PARSE("2021-01-25T14:23:41.000Z")
In certain situations it’s not necessary to pass a formatting string to the DATETIME_PARSE()
function, and this is one of those. It automatically converts to the correct time.
Next, the correct way to use IS_AFTER()
to compare two dates is by passing each date as a separate argument:
IS_AFTER([date1], [date2])
Inserting the LAST_MODIFIED_TIME()
function and our converted date string into this structure gives us this:
IS_AFTER(LAST_MODIFIED_TIME(), DATETIME_PARSE("2021-01-25T14:23:41.000Z"))
Putting all of that into your Python variable would then look like this:
filterByFormula = 'IS_AFTER(LAST_MODIFIED_TIME(), DATETIME_PARSE("2021-01-25T14:23:41.000Z"))'