On Tue, Jun 30, 2009 at 7:50 AM, Gilles Ganault<gilles.gana...@free.fr> wrote: > Hello > > I read http://www.sqlite.org/lang_datefunc.html, but I still don't > know how to extract the year from a table where a column has dates > formatted as YYYY-MM-DD. > > Currently, I use this, but I'm sure there's a better way: > > ====== > //Find all invoices sent in 2009 > SELECT * FROM invoices,phones WHERE phones_nbr=invoices_phones_nbr AND > invoices_date_sent GLOB '2009-*' > ======
SQLite version 3.6.11 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> SELECT strftime('%Y', '1999-12-03') AS year; 1999 sqlite> .. -- Puneet Kishor http://www.punkish.org/ Carbon Model http://carbonmodel.org/ Charter Member, Open Source Geospatial Foundation http://www.osgeo.org/ Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor/ Nelson Institute, UW-Madison http://www.nelson.wisc.edu/ ------------------------------------------------------------------------- assertions are politics... backing up assertions with evidence is science ========================================================================= _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users