I have created a database for my application and I use timestamp (yyyy-MM-dd HH:mm:ss) as an attribute of my table. How can I basically query the database to get the last 7 days results?
I was thinking something like that SELECT * FROM myTable WHERE date('now','-7 days') but it doesnt seem to work since i dont actually compare it with my timestamp.
I have created a database for my application and I use timestamp (yyyy-MM-dd HH:mm:ss)
Share
SQLite only has very few Date and Time Functions. So your best bet would be creating two compatible datetime strings in the format
YYYY-MM-DD HH:MM:SS(one for today and one for one week ago). Then feed those values to a SQLite query (you can compare with<or>).