I am developing a program using HTML5 and chose websql as my data storage.
The problem is the following. I need to select from the database tasks belonging only today.
Data in the database are similar to the following
TASK_ITEM START_DATE END_DATE
"Task Title1" "2018-04-23 0:52" "2018-04-23 1:07"
"Task Title1" "2018-04-23 0:56" "2018-04-23 1:11"
"Task Title1" "2018-05-23 0:58" "2018-05-23 1:13"
I am trying to select data as follows.
var curDate = moment().format('YYYY-MM-DD')
this.db.transaction(function(tx){
tx.executeSql("SELECT * FROM task where DATE(start_date)=? ORDER BY TIME(start_date) ASC", [curDate], function(tx,result){
for (var i=0; i < result.rows.length; i++) {
var task_item = result.rows.item(i).task_item;
var id = result.rows.item(i).id;
var start = result.rows.item(i).start_date;
var end = result.rows.item(i).end_date;
var details = result.rows.item(i).details;
var status = result.rows.item(i).acept;
console.log(id, task_item, start, end, details, status);
}
});
});
A similar query worked in mysql but not in websql.
How to solve the problem?
etc. That kind of stuff.
– Nathan Smith Apr 23 '18 at 20:08