Murray @ PlanetThoughtful wrote:

Hi All,

I have a second question re: dates in SQLite and 'localtime'.

I have a table with a DEFAULT CURRENT_TIMESTAMP field.

I'm trying to retrieve a recordset of records that have been added to that table today (but, of course, because the field stores UTC, the value for the majority of those records are datetime values for yesterday).

In SQLSERVER2K I'm used to retrieving records for a given day by using something like:

SELECT * FROM table WHERE datefield BETWEEN '2005-12-23' AND '2005-12-23';

I've experimented with a number of different SQL statements in SQLite to achieve the same result, but nothing (so far) returns records I added with a local date of today (which is '2005-12-23').

Can anyone help me understand how to achieve this in SQLite?

Many thanks and much warmth,

Murray

Murray,

Try the following:

select * from table where
   date(datefield) = date('now');

HTH
Dennis Cote

Reply via email to