First, format dates to the ISO-8601 standard. Wrap it in Date () to make sure it is treated as DATE. Finally, build your assortment so that it includes everything from 12:00 until the next morning until the next morning.
select itemId, dateColumn from items where dateColumn >= date('2012-10-23') AND dateColumn < date('2012-10-23', '+1 day')
SQLite columns are not printed . However, if you are comparing a column with DATE, as shown, it is sufficient to force the column data in dates (null if they are not valid), and the comparison will work correctly.
SQLFiddle example:
create table items ( itemid, datecolumn); insert into items select 1,'abc' union all select 2,null union all select 3,'10/23/2012 12:23' union all select 4,'10/23/2012' union all select 5,'2012-10-23 12:23' union all select 6,'2012-10-23' union all select 7,'2012-10-24 12:23' union all select 8,'2012-10-24' union all select 9,date('2012-10-24 12:23') union all select 10,date('2012-10-24');
Results:
itemid datecolumn 5 2012-10-23 12:23 6 2012-10-23
Note that although lines 3 and 4 display as dates, they are not, as they do not conform to the ISO-8601 formatting, which is the only format recognized by SQLite.
source share