[sqlite] Time and date functions

2011-10-16 Thread Nando
Thank you all. The solution of Jean-Christophe is perfect and thanks to Igor and Michael I begin to understand the logic of the processing of dates in SQLite, which is much more powerful than it had expected at first. sqlite> select * from fechas where fecha between date('2011-12-18','-6 days','

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)
> insert into t values('2011-10-10'); sqlite> insert into t values('2011-10-11'); sqlite> insert into t values('2011-10-12'); sqlite> insert into t values('2011-10-13'); sqlite> insert into t values('2011-10-14'); sqlite> insert

[sqlite] Time and date functions

2011-10-15 Thread Nando
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 where DATE between date('n