Page 1 of 1

How can I filter dates?

Posted: 2023-05-15 19:19
by compusoft
Hi All

I have a simple table Reservas, with several fields. One of them is Date, (type date of course)
When I try to run a simple query filter on it
filter1.jpg
filter1.jpg (35.3 KiB) Viewed 3135 times

Always return "No matches found!". Doesn't matter if I use quotes or not around the date ('2023-05-12'), or the order DD-MM-YYYY

Howewer, when I run the followin query on MySQL console

SELECT * FROM `reservas` WHERE `Date` = '2023-05-12'

the result is, as expected:

query1.jpg
query1.jpg (94.29 KiB) Viewed 3135 times
What I'm doing wrong? How can I filter on dates?

Regards!

Re: How can I filter dates?

Posted: 2023-05-17 05:52
by peebee
When filtering a date data type field - I think you'll find it depends on what date format you originally selected to store date fields in your Appgini project.

Let's say you select DD/MM/YYYY for date formats in your Appgini project

"date" type fields are of course still recorded in the database as YYYY-MM-DD

But to filter one of those date fields in the app, use the format originally chosen in the Appgini project - DD/MM/YYYY

Works for me - hopefully it will work for you too

Re: How can I filter dates?

Posted: 2023-05-17 07:54
by onoehring
Hi,

I would also thin, you will need to enter the date as it is displayed in your table view.
Olaf

Re: How can I filter dates?

Posted: 2023-05-17 15:07
by compusoft
Hi

Thansk for your help!. Yes, you are right. The orginal format in Appgini was 'DD/MM/YYYY'

So, the filter must be like 15/05/2023. The trick was the slash! (/)

Thanks again!

Re: How can I filter dates?

Posted: 2023-05-19 07:06
by onoehring
Hi,

do you know: You can change how the dates are displayed in AG
dateformat.png
dateformat.png (52.81 KiB) Viewed 3016 times
Olaf