Question

strftime('%s', 'now', 'start of month') AND strftime('%s', 'now', 'start of month', '+1 month', '-1 day')

this gives me range between first and last day of current month. How can I get range of current week?

This

 strftime('%s', 'now', 'weekday 0')

gives seems to give last day of current week(Sunday), but I can't find how to get first day of current week.

PS: I use strftime in WHERE clause accessing DB in Sqlite

Was it helpful?

Solution

Try this:

strftime('%s', 'now', 'weekday 0', '-1 week', '+1 day')

strftime('%s', 'now', 'weekday 0', '-1 day')

weekday modifier advances the date forward to the next date where the weekday number is N. Sunday is 0, ...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top