On 7 Dec 2012, at 4:24pm, Paxdo Presse <pa...@mac.com> wrote:

> select invoice.date from invoice where strftime('%m', invoice.date)='02' and 
> strftime('%w', invoice.date)='1'
> 
> For invoices made ​​on a Monday in February.
> From your experience, these requests are they fast?

'fast' is the wrong question.  'fast enough' is the right question.

But do you really do things like run a search on "invoices made ​​on a Monday 
in February" ?  Most of the time I store a date I'm storing it for three 
purposes:

A) to print it back out again
B) to sort by date
C) to search for rows within a particular date range

You almost never need to do things like subtract one date from another.  Given 
the above, most of my systems store dates as strings in this format "YYYYMMDD". 
 This gives me superfast (B) and (C ).  If I want to print the date out it 
doesn't matter if I process slowly because the printer is even slower, so I 
convert from that format.

In those rare cases where I am going to want to do maths on a date (e.g. 
subtract one date from another) I store dates in a numeric format (julianday or 
unixepoch) and when I do this I often store a text version of the date too, 
because it makes debugging so much easier.

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

Reply via email to