How to get events in the last 24 hours using SQLite?

I have a column with date and time records, and I would like to receive all the items in the last 24 hours. Now I am trying:

SELECT * FROM " + SQLHelp.LOG_TABLE + " WHERE " + SQLHelp.TIME_COLUMN + "> datetime('now','-1day') 

where SQLHelp.LOG_TABLE and SQLHelp.TIME_COLUMN are the names of the table and column, respectively.

+4
source share
1 answer

There must be a space between -1 and day ; datetime('now','-1 day') works as expected.

+3
source

Source: https://habr.com/ru/post/1442546/


All Articles