I have a table which has amongst others a date column servdate.
I use the following query to get me all jobs from within the past week ( a week starts f
SELECT _id, busnum, date_format(servdate, '%a') as servdayofweek
FROM tb1
WHERE servdate BETWEEN date('now', 'Weekday 1', '-21 days') AND date('now')
The %a is the abbreviated day of the week. See the documentation for other ways to format.
edit:
Oops! Overlooked the sqlite tag. The above is for MySQL. For sqlite (documentation):
SELECT _id, busnum, strftime('%w', servdate) as servdayofweek
FROM tb1
WHERE servdate BETWEEN date('now', 'Weekday 1', '-21 days') AND date('now')
except this returns the day of week as a value 0 through 6. Maybe that's good enough?