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

Re: Querying DATE column with date/time string.

by Doug Van Horn :: Rate this Message:

Reply to Author | View in Thread

Doug Van Horn wrote:
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
Thanks Dan, Igor, Donald, and Simon! It's a problem with the Django library (a Python web framework), where that between clause is being used for several different databases. I'm going to report back there with your (collective) explanation. I appreciate the help!

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