Thursday, 15 March 2012

cordova - Date Range Query in Sqlite for my phone gap mobile app -



cordova - Date Range Query in Sqlite for my phone gap mobile app -

i trying info sqlite db of phone gap app providing date , date. surprise me when trying -

select * pathistory patdate >= '2014-04-20' , patdate <= '2014-04-20' order patdate desc; --->> not result. result.length = 0. have tried query using between still no result came. when - select * pathistory patdate >= '2014-04-20'; --> proper data.

what doing wrong here?? please help !! below table structure, in case u need @ -

create table if not exists pathistory( \ pathistoryid varchar not null primary key , \ patdate datetime \ );

i noticed patdate datetime field reather date, means storing time value in database, first query equvalent to:

select * pathistory patdate == '2014-04-20 00:00:00'

and second:

select * pathistory patdate >= '2014-04-20 00:00:00'

i suspect if run if run:

select * pathistory patdate == '2014-04-20'

you won't results, because don't have record @ time 00:00:00

sqlite cordova

No comments:

Post a Comment