ahmd0
ahmd0

Reputation: 17293

SQLite SELECT date for a specific month

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?

Upvotes: 18

Views: 33049

Answers (2)

ikegami
ikegami

Reputation: 385647

How about

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

Date And Time Functions

Upvotes: 50

manji
manji

Reputation: 47978

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

sqlite date&time functions

Upvotes: 13

Related Questions