Date Comparison

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Date Comparison

John Buck
If I have a table with a "date" column type.

Is this valid in SqLite??

Select * from MYTABLE where my_date_field > '2005-05-01';


--
JB
Reply | Threaded
Open this post in threaded view
|

Re: Date Comparison

Jay Sprenkle
On 5/24/05, John Buck <[hidden email]> wrote:
> If I have a table with a "date" column type.
>
> Is this valid in SqLite??
>
> Select * from MYTABLE where my_date_field > '2005-05-01';

please read the docs.
http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions
Reply | Threaded
Open this post in threaded view
|

RE: Date Comparison

John Buck
Already did.  
It doesn't talk about date comparison.

-----Original Message-----
From: Jay Sprenkle [mailto:[hidden email]]
Sent: Tuesday, May 24, 2005 2:21 PM
To: [hidden email]
Subject: Re: [sqlite] Date Comparison

On 5/24/05, John Buck <[hidden email]> wrote:
> If I have a table with a "date" column type.
>
> Is this valid in SqLite??
>
> Select * from MYTABLE where my_date_field > '2005-05-01';

please read the docs.
http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions


Reply | Threaded
Open this post in threaded view
|

Re: Date Comparison

Paolo Vernazza
In reply to this post by John Buck
John Buck wrote:

>If I have a table with a "date" column type.
>
>Is this valid in SqLite??
>
>Select * from MYTABLE where my_date_field > '2005-05-01';
>
If you saved the data in my_data_field as yyyy-mm-dd, the, yes, your
query is valid.

Paolo

Reply | Threaded
Open this post in threaded view
|

Re: Date Comparison

Kurt Welgehausen
In reply to this post by John Buck
> Already did.
> It doesn't talk about date comparison.

Dates are stored in SQLite as strings or numbers (your
choice). Comparisons of dates are just comparisons of
strings or numbers. There is no Date type.

Regards
Reply | Threaded
Open this post in threaded view
|

RE: Date Comparison

John Buck
In reply to this post by Paolo Vernazza
I did, but I always got a false from the comparison.

All dates are stored 'YYYY-mm-dd'

I had to end up doing this to make it work:

Where ( strftime("%Y%m%d",my_date_field)+0 ) > 20050501





-----Original Message-----
From: Paolo Vernazza [mailto:[hidden email]]
Sent: Tuesday, May 24, 2005 3:51 PM
To: [hidden email]
Subject: Re: [sqlite] Date Comparison

John Buck wrote:

>If I have a table with a "date" column type.
>
>Is this valid in SqLite??
>
>Select * from MYTABLE where my_date_field > '2005-05-01';
>
If you saved the data in my_data_field as yyyy-mm-dd, the, yes, your
query is valid.

Paolo


Reply | Threaded
Open this post in threaded view
|

Re: Date Comparison

victor...
In reply to this post by John Buck
Hi!
 
My date field is integer. I record the value returned by function time() (time.h).
When i need to do some comparison, i use a function that i created in sqlite for use in my sql statements. This function works like strftime. I pass the time and the format (like "%m-%d-%y") and it returns a char with the date formatted.
 
 
[]'s
Victor
 

Kurt Welgehausen <[hidden email]> escreveu:
> Already did.
> It doesn't talk about date comparison.

Dates are stored in SQLite as strings or numbers (your
choice). Comparisons of dates are just comparisons of
strings or numbers. There is no Date type.

Regards



"S? existem 10 tipos de pessoas, as que sabem e as que n?o sabem bin?rio."
__________________________________________________
Converse com seus amigos em tempo real com o Yahoo! Messenger
http://br.download.yahoo.com/messenger/