Following up on this question: How to query a SQL Lite database using flutter sqflite
I am storing the time the database entries are added using an int that is calculated:
static int currentTimeInSeconds() {
var now = (DateTime.now()).millisecondsSinceEpoch;
return now;
}
And getting the sum of the amount Column in my Water database using the following in my database_manager.dart file:
Future<int> sumItems() async {
await openDb();
final sum = await _database.rawQuery("SELECT sum(amount) as sum FROM Water");
return sum[0]["sum"];
}
How do I only return todays items in the sumItems() function?