How can I get specific month data from a SQLite database

I saved the data in a SQLite database. I saved the date in the database as a DATETIME data type.

I want to extract only the data of a specific month from the SQLite database.

I am trying to execute the query below to retrieve data, but it was not useful. This gives me data, but it was not a specific month.

SELECT coulumn_name FROM table_name WHERE column_name Between "MM-DD-YYYY" AND "MM-DD-YYYY"
+5
source share
2 answers

This is probably not optimal, but you can use:

select column_name from table_name where strftime('%Y-%m', column_name) = '2011-05';
+7
source

Use function to get only month of date

SELECT strftime('%m', date(column_name)) FROM table;

I believe this is a feature, but I'm not sure.

+2
source

All Articles