Like mysql Date

Is there a way to do a like statement with query builder? I am trying to achieve

WHERE data.arrival LIKE ‘%2019-11-29%’ AND data.arcitycode = ‘bwi’.

The date and city code being url variables. The date I am searching is a datetime field, but I just need the date not the time.

thanks

Please check:

What do the emojis represent?

Not sure what you mean, but click on the link i posted and check the discussion please.

contains does not exist in the query builder.

Contains is available for strings only.

So there is no way to do a contains with a date? sorry a little lost. I can put the LIKE in a custom query, but not sure how to get the url variable in the statement with the % :P1 % for example

Well, no that’s not possible - but i am not sure i understand what are you trying to achieve?

I simply want to query a date, but just the date part of the datetime field.

How do you filter it - where does the filter value(s) come from?

URL variable. example ?arrivaldate=‘2019-11-29’.

Do you store hours or it is just the default 00:00:00 as you are using DATETIME database fields?

there are hours and minutes in the date time field. This is a list of flights. all have arrival times, but I want to just get everything for the day. Ignoring the time.

Then you can use the between condition and then format the date, in the format you need using the data formatter:

{{$GET_variable.formatDate("yyyy-MM-dd 00:00:00")}}

and

{{$GET_variable.formatDate("yyyy-MM-dd 23:59:59")}}

Perfect! thank you

1 Like