Hi Wang,
Yes, DATEFORMAT is supported in OQL in Mendix 11.12.4. It was introduced in Mendix 11.12.0, and the documentation lists the syntax as:
DATEFORMAT(expression, pattern)
So the Unknown function 'dateformat' error is not expected simply because the app is using OQL version 2.
Since you're using Studio Pro 11.12.4 + View Entity + OQL v2, I would check the following:
DATEFORMAT(YourDateAttribute, 'yyyy-MM-dd')
For example:
SELECT
a.CreatedDate AS CreatedDate,
DATEFORMAT(a.CreatedDate, 'yyyy-MM-dd') AS CreatedDateFormatted
FROM MyModule.Asset AS a
DATEFORMAT takes a DateTime expression and a string pattern, and returns a string.
Unknown function 'dateformat'
The function was added specifically in 11.12.0, so an older runtime/parser would explain the discrepancy.
Also, OQL v2 itself is not the problem. View Entities require OQL v2, and Mendix confirms that View Entity queries use the OQL v2 syntax.
So I wouldn't downgrade to OQL v1 or replace the View Entity.
My first test would be to restart the app completely using the same 11.12.4 installation and then run the query again. If it still reports the same error, I'd check the exact OQL expression and whether the app/runtime is really running the 11.12.4 runtime.
Hope this helps.