Re: [sqlite] Time and date functions

2011-10-15 Thread Igor Tandetnik
Nando wrote: > I just realized that the "weekday" is not working as and believed, but is > much easier. I can make simple queries of the form: > > select * from dates WHERE date = date ('2011-12-09 ',' weekday 5 '); > > Or > > select * from dates WHERE date <= date ('2011-12-04 ',' weekday 6 ')

Re: [sqlite] Time and date functions

2011-10-15 Thread Nando
I just realized that the "weekday" is not working as and believed, but is much easier. I can make simple queries of the form: select * from dates WHERE date = date ('2011-12-09 ',' weekday 5 '); Or select * from dates WHERE date <= date ('2011-12-04 ',' weekday 6 '); And they work properly. But

Re: [sqlite] Time and date functions

2011-10-15 Thread Jean-Christophe Deschamps
select * from TABLE where DATE between date('now','-7 days','Weekday 0') and date('now','-7 days','Weekday 6'); Let me try this: select * from TABLE where DATE between date('now','-6 days','Weekday 0') and date('now','Weekday 6'); or compare week numbers (%W specification) [slower]

Re: [sqlite] Time and date functions

2011-10-15 Thread Igor Tandetnik
Nando wrote: > SQLite system for working with dates is very powerful, but I find it > strange. I'm trying to select the dates between the beginning and end of a > week defined from the date of a given day. If I understand the documentation > thing this code should work: > > > select * from TABLE

Re: [sqlite] Time and date functions

2011-10-15 Thread Black, Michael (IS)
That's because today is Saturday. So 'Weekday 6' is Saturday which is the same as 'now' - 7 days. No date advance is done. sqlite> select date('now','-7 days','Weekday 0'); 2011-10-09 sqlite> select date('now','-7 days','Weekday 1'); 2011-10-10 sqlite> select date('now','-7 days','Weekday 2');