NathanWay
NathanWay

Reputation: 139

SQLite How to know if date column is current month

I have this problem with SQLite, I have the right query in SQL Server but SQLite is differente I want to know if a Char Column that contains dates can be converted to date and then know and then filter the dates where the month correspond to the current month.

Here's the table with a row of data

Images

The column that need to know is the current month is FechaCapCalend

Thanks ^_^

Upvotes: 0

Views: 883

Answers (1)

Nathan
Nathan

Reputation: 171

SELECT strftime('%m', FECHACAPALEND)

Returns numeric month where FECHACAPALEND is column of a string date. To compare to current:

SELECT CASE WHEN strftime('%m', 'now') = strftime('%m', FECHACAPALEND) THEN 'Yup' ELSE 'Nope' END  

Upvotes: 2

Related Questions