Another possibility is to store dates as strings in ISO8601 format:

'20041220'
'20050114'

The conversion is simple (doesn't need epoch functions), and the strings
compare the same as dates.  It doesn't give you a way to compute the
difference between two dates, but does let you select a range.

--Ned.
http://nedbatchelder.com


-----Original Message-----
From: teoh [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 27, 2005 12:13 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] sqlite search by "DATE" range ?

does that mean. i just create  "timedate int" in sql.
and use  unixepox to store the date+time inside it.
and query it using unixepox for range ?

select * from table1 where timedate >=
unixepox_number1 and timedate <= unixepox_number2;

is this correct? thank you.



--- [EMAIL PROTECTED] wrote:

> teoh <[EMAIL PROTECTED]> writes:
> 
> > does anyone knows algorithm use to quote date
> range?  
> > let say, user wants to quote for result from
> > 20-12-2004 until 14-1-2005 ?    (dd-mm-yyyy)
> 
> This page contains all of the information about
> supported date and time
> functions in SQLite:
> 
>
http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions
> 
> You'll probably want to save your dates as a single
> number for ease of
> manipulation and comparison.  If all you care about
> are dates (i.e. without
> associated times during the day), then you can use
> the Julian day number, "%J"
> in the strftime() documentation.  If you need times
> as well, then a convenient
> format may be the Unix epoch value, the number of
> seconds since 1970-01-01 at
> midnight, "%s" in strftime().
> 
> Derrell
> 



        
                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail


Reply via email to