How can I filter dates?

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
compusoft
Posts: 18
Joined: 2023-05-05 09:14

How can I filter dates?

Post by compusoft » 2023-05-15 19:19

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 1650 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 1650 times
What I'm doing wrong? How can I filter on dates?

Regards!

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: How can I filter dates?

Post by peebee » 2023-05-17 05:52

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

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: How can I filter dates?

Post by onoehring » 2023-05-17 07:54

Hi,

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

compusoft
Posts: 18
Joined: 2023-05-05 09:14

Re: How can I filter dates?

Post by compusoft » 2023-05-17 15:07

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!

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: How can I filter dates?

Post by onoehring » 2023-05-19 07:06

Hi,

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

Post Reply