Re: [sqlite] SQL example using date()

2008-12-02 Thread Igor Tandetnik
Greg Robertson <[EMAIL PROTECTED]>
wrote:
> I would like to do a date search to find records that are between two
> dates. The dates are stored in the table in the format DD-MM- but
> I can change that to another format but I prefer something readable
> rather than an int or double.

Just do -MM-DD. Then a simple string comparison also happens to be 
correct for dates.

For more complex date and time manipulation, see 
http://sqlite.org/lang_datefunc.html

Igor Tandetnik



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQL example using date()

2008-12-02 Thread P Kishor
On 12/2/08, Greg Robertson <[EMAIL PROTECTED]> wrote:
> I would like to do a date search to find records that are between two
>  dates. The dates are stored in the table in the format DD-MM- but
>  I can change that to another format but I prefer something readable
>  rather than an int or double.
>
>  Could someone point me to some docs that could help me write the SQL
>  and figure out the best format I should store my dates in?
>

Well, generally the format considered the "best" by many is the
Julianday REAL format, but yes, it is unreadable by humans. You can
always store the data as you want, but to do any calculations, you can
use the datetime functions to convert to an appropriate format to do
the math.

See the wiki for datetime functions.

>  Thanks
>
>  Greg



-- 
Puneet Kishor http://www.punkish.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQL example using date()

2008-12-02 Thread Greg Robertson
I would like to do a date search to find records that are between two
dates. The dates are stored in the table in the format DD-MM- but
I can change that to another format but I prefer something readable
rather than an int or double.

Could someone point me to some docs that could help me write the SQL
and figure out the best format I should store my dates in?

Thanks

Greg
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users