« Return to Thread: Querying DATE column with date/time string.

Querying DATE column with date/time string.

by Doug Van Horn :: Rate this Message:

Reply to Author | View in Thread

Hi,

I'm running into a problem with the database library in Django running against SQLite.  I'm trying to understand why the following happens:

$ sqlite3 date_test
SQLite version 3.4.2
Enter ".help" for instructions
sqlite> create table foo (d date null);
sqlite> insert into foo (d) values ('2008-01-01');
sqlite> select d from foo where d between '2008-01-01' and '2008-01-31';
2008-01-01
sqlite> select d from foo where d between '2008-01-01 00:00:00' and '2008-01-31 23:59:59.999999';
sqlite> .quit

In English, why does adding the 'time' portion to the between clause not find the record?


Thanks for any help or insights...

Doug Van Horn

 « Return to Thread: Querying DATE column with date/time string.