Cake 3.7.5 and search component

Hello guys. I’m working on a project with version 3.7 of cakephp and using the “search” of friends of cake.

In a view I need to do research in several fields. One of them is a date field (MySql database) in the format dd / mm / YYYY h: m.

But I’m having a problem with that. The search only works in the data field if I search using dd / mm / yy and not dd / mm / yyyy.

In the code I do the date conversion using the MySql documentation recommendation, but when searching it doesn’t work.

Here is the code and the result:

WHERE
(
Questions.name like ‘%19/01/2021%’
OR Requesters.name like ‘%19/01/2021%’
OR SisadDemandTypes.name like ‘%19/01/2021%’
OR Neighborhoods.name like ‘%19/01/2021%’
OR date_format(
SisadDemands.demand_date, “%d/%m/%y %h:%i”
) like ‘%19/01/2021%’
)
ORDER BY
SisadDemands.id DESC
LIMIT
10 OFFSET 0

Through the debug, I notice that the result of the query makes the “Y” in lower case, affecting the result

Any guidance? Thanks

Same type case i worked well you need to CAST(StudentAnswers.answer AS DATE) cast you date field into date then compare the date.
i think this help you :grinning: