Andy
Andy

Reputation: 10840

Way to construct a query in which a date falls between a start and end date in SQLite?

The way I have it so far is:

select * from time where date('now') > date(start_date) and date('now') < date(end_date);

I was just hoping there was a short way to construct this same query. I checked the Docs for SQLite's date functions, but its hard to understand, and there isn't an obvious function that does it. If there is not a way, that is fine, but I wanted to check with expert users in SQLites ways. Thanks in advance!

Upvotes: 1

Views: 73

Answers (1)

Alex Lockwood
Alex Lockwood

Reputation: 83311

SELECT *
FROM TIME_TABLE 
WHERE DATE_COLUMN 
BETWEEN '01-01-2012' 
AND '12-31-2012'

Upvotes: 1

Related Questions