SQLite SELECT date for a specific month

2019-01-23 16:47发布

问题:

I was using Microsoft's Jet database engine before. And, say, if I needed to select entries for a specific month I do this:

SELECT * FROM `table name` WHERE MONTH(`date column`)=4

But how do you do the same with SQLite?

回答1:

How about

SELECT * FROM table_name WHERE strftime('%m', date_column) = '04'

Date And Time Functions



回答2:

SELECT * FROM `table name` WHERE strftime('%m', `date column`) = '04'

sqlite date&time functions