I would like to retrieve from a SQLite database a list of events which have their start_time “today”. start_time contains a timestamp e.g. like this 1338613200000.
I tried this:
SELECT * FROM events WHERE date(start_time, 'unixepoch')=date('now')
Doesn’t work…
I achieved the same thing in MySQL with such a statement:
SELECT * FROM events WHERE DATE(start_time)=CURDATE();
EDIT:
It’s the problem with my timestamps. They have three zeros too much
Java uses milliseconds since the Unix epoch, whereas I’m guessing SQLite uses seconds.
Divide System.currentTimeMillis() by 1000 before querying the database.