Create a column with DATE type and Sqlite will make it numeric affinity.
Store the date in Sqlite format using the date functions julianday,
datetime etc. You can use the strftime function for special date
formatting.
Sqlite has functions to go from ISO8601 date format to the internal date
format which is based on an astronomical epoch. The internal numerical
date and time format makes comparisons straightforward.
Chris Peachment wrote:
Why don't you try it and see?
Use the sqlite3 command line interpreter
with the a sample database.
On Sun, 19 Aug 2007 13:28:20 +0200, Daniel Cohen Gindi wrote:
Can I create a table with DATE datatype? Or just use text datatype with
yyyy-mm-dd?
I can see that sorting will be easy with just text yyyy-mm-dd,
But what about BETWEEN or > <? Or maybe strcmp() does the job?
Thanks
Daniel
-----Original Message-----
From: Chris Peachment [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 19, 2007 12:19 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Making SQL queries with date conditions?
Use the ISO date format yyyymmdd or yyyy-mm-dd
and your sort and search problems disappear.
On Sun, 19 Aug 2007 12:16:41 +0200, Daniel Cohen Gindi wrote:
Hi guys!
Is there any way to make SQL queries, with the WHERE clause containing
dates? I mean [WHERE col > 05/12/2007] or such?
It just that I have noticed that there's no DATE datatype.
If there's no way, is it easy to override the text comparing operators (<=,
=, <, >) ?
Thanks a lot!
----------------------------------------------------------------------------
-
To unsubscribe, send email to [EMAIL PROTECTED]
----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------