Sqlite Cheatsheet
Table of contents
Date
Sqlite date
I store date in sql in “YYYY-mm-dd” format, stored as a string. You can use sqlite to extract the year month or day.
strftime('%Y', '%m', '%d')
You can use any of them just as a variable.
Get month from date string
SELECT * FROM table WHERE strftime('%m', datefield) = '05'
Get data between months
SELECT * FROM bales WHERE (strftime("%m", date) between "09" and "10")