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 from monday):
SELECT * FROM tb1 WHERE servdate BETWEEN date('now', 'Weekday 1', '-21 days') AND date('now')
I want the query to work exactly the same but instead to return the servdate
fields as their corresponding day of the week. For example, "monday", instead of "2010-11-28".
Is this possible?
Select the cells you want to format. Press Control+1 or Command+1. In the Format Cells box, click the Number tab. In the Category list, click Date, and then choose a date format you want in Type.
You can use an ancillary table as wallyk suggested; or you can use a case
expression:
select _id, busnum,
case cast (strftime('%w', servdate) as integer)
when 0 then 'Sunday'
when 1 then 'Monday'
when 2 then 'Tuesday'
when 3 then 'Wednesday'
when 4 then 'Thursday'
when 5 then 'Friday'
else 'Saturday' end as servdayofweek
from tb1
where ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With