Hi all and happy 2021.
I'm run into the problem (yes, I know, my fault).
The problem is that I saved date into my table like this 05/05/2020. For the whole year it was OK but this morning I realized that I did it wrong.
When I run a query like this
I got nothing and the app shows me wrong info.
So my question is - is it safe to change the query to this
Or it's better to use
and pass TickFrom and TickTo as parameters
Thanks.
I'm run into the problem (yes, I know, my fault).
The problem is that I saved date into my table like this 05/05/2020. For the whole year it was OK but this morning I realized that I did it wrong.
When I run a query like this
B4X:
select * from mytable where jobdate between '12/31/2020' and '1/1/2021'
I got nothing and the app shows me wrong info.
So my question is - is it safe to change the query to this
B4X:
select * from mytable
where julianday((substr(NN.JobDate,7,4) || '-' || substr(NN.JobDate,1,2) ||'-' || substr(NN.JobDate,4,2) || 'T00:00:00')) between
julianday(DATE('now','-1 day', 'localtime')) and julianday (date('now','localtime') )
Or it's better to use
B4X:
dim TickFrom as Long=DateTime.Dateparse(strDateFrom)
dim TickTo as Long=DateTime.Dateparse(strDateTo)
and pass TickFrom and TickTo as parameters
B4X:
select * from mytable
where julianday((substr(NN.JobDate,7,4) || '-' || substr(NN.JobDate,1,2) ||'-' || substr(NN.JobDate,4,2) || 'T00:00:00')) between
? and ?
Thanks.
Last edited: