[Gambas-user] Search Between Dates
Denis Crowther
denisc at exemail.com.au
Sun Oct 7 03:47:58 CEST 2018
Sql date format uses "-" and 2 digit month/days, so
Format(DateBox1.Value, "yyyy-mm-dd")
You should also take care with the possibility of 'times' creeping in.
I would use;
Select from visits where vdate >= date1 and < (date2 + 1 day)
which will get any in the date range req'd no matter what time they may
have.
Regards
Denis
On 7/10/18 10:19 am, Wael M via User wrote:
> Hi all
>
> I have a SQLite database
> I need to search between two dates
> I'm using this code but doesn't work
> it gives no error but returns nothing
>
> TextBox1.Text = Format(DateBox1.Value, "yyyy/m/d")
> TextBox2.Text = Format(DateBox2.Value, "yyyy/m/d")
>
> $rs = ModMain.$con.Exec("SELECT * FROM Visits WHERE Vdate BETWEEN '" & TextBox1.Text & "' AND '" & TextBox2.Text & "'")
>
> any suggestions?
>
> WaeL
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
More information about the User
mailing list