On Wed, Mar 11, 2009 at 11:08 PM, jonwood <nab...@softcircuits.com> wrote:
>
>
> Doug Currie-2 wrote:
>>
>> Note the '/'s
>>
>
> What does this mean? What does DATE('2009-1-1') or DATE('2009/1/1') return?
> Does DATE() simply have no effect whatsoever?
> --


why don't you try it? See below --

[07:42 PM] ~/Projects$sqlite3
SQLite version 3.6.11
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> CREATE TABLE foo (a DATETIME);
sqlite> INSERT INTO foo VALUES ('2009-03-11');
sqlite> INSERT INTO foo VALUES ('2009/03/11');
sqlite> SELECT * FROM foo;
2009-03-11
2009/03/11
sqlite> SELECT date(a) FROM foo;
2009-03-11

sqlite>

----
Dates are stored as strings in SQLite, but the string has to be
formatted as yyyy-mm-dd hh:mm:ss. You can't use any old delimiter. If
you use the correct delimiter, then the built in function date()
allows you to do magic stuff with dates.



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

Reply via email to