A. Bantero
A. Bantero

Reputation: 21

MySQL query to SQLite query for activities for the past 24 hours

I have a query in MySQL that i want to convert in SQLite. This is my Query:

SELECT * FROM timelogs where `time` >= now() - INTERVAL 1 day

I'd like to get the time entries for the past 24 hours. Anyone who can help me with this?

Upvotes: 0

Views: 22

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 522171

Try this query:

SELECT *
FROM timelogs
WHERE time >= datetime('now', '-1 day')

datetime('now') will return the current date time in YYYY-MM-DD HH:MM:SS format, and then we can offset this by one day.

Upvotes: 1

Related Questions