[Gambas-user] Search Between Dates
Wael M
wael79xy at yahoo.com
Sun Oct 7 11:26:52 CEST 2018
I figured out what was wrong
I put search criteria as "yyyy/m/d" but I had the date saved as "dd/mm/yyyy"
so all I needed to do is to save the date in this format "yyyy/m/d" and it worked accurately
thanks Denis but using "/" worked and gave me the same results as using "-"
also date format as "yyyy/m/d" gave more accurate results than "yyyy/mm/dd"
maybe sqlite is different that sql ... idk
WaeL
--------------------------------------------
On Sun, 10/7/18, Denis Crowther <denisc at exemail.com.au> wrote:
Subject: Re: [Gambas-user] Search Between Dates
To: "Wael M via User" <user at lists.gambas-basic.org>
Date: Sunday, October 7, 2018, 4:47 AM
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 ]----
>
----[ Gambas mailing-list
is hosted by https://www.hostsharing.net ]----
More information about the User
mailing list