We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
Does someone can tell me what am I doing wrong ?
DB is installed. The field 'completed' in table is a TEXT (and I have also tried with a DATE).
Trying to do this:
async delete() { const db = await this.getInstance(); await db.transaction((tx) => { const sql = 'DELETE FROM my_table WHERE (completed < DATE(\'now\', \'-1 minute\'))'; tx.executeSql(sql, [], (tx, res) => { console.log('removed'); }, function(tx, error) { console.log('DELETE error: ' + error.message); }); }); }
I can delete everything without the WHERE condition, but I'm stuck when I try to filter with this WHERE (completed < DATE('now', '-1 minute'))
The text was updated successfully, but these errors were encountered:
Thanks. I had trouble following your sample code, reformatting here:
I generally recommend formatting JavaScript samples like this:
```js // some code here ```
(or use ts, jsx, or tsx in case of TypeScript, jsx, or tsx code)
ts
jsx
tsx
Unfortunately I cannot think of very much without knowing how you populated the completed field in the first place.
completed
Back in 2016 I started to document some pitfalls I discovered related to time and date handling in the following places:
and some important reading here: https://www.sqlite.org/lang_datefunc.html
Sorry, something went wrong.
No branches or pull requests
Hello,
Does someone can tell me what am I doing wrong ?
DB is installed. The field 'completed' in table is a TEXT (and I have also tried with a DATE).
Trying to do this:
async delete() { const db = await this.getInstance(); await db.transaction((tx) => { const sql = 'DELETE FROM my_table WHERE (completed < DATE(\'now\', \'-1 minute\'))'; tx.executeSql(sql, [], (tx, res) => { console.log('removed'); }, function(tx, error) { console.log('DELETE error: ' + error.message); }); }); }
I can delete everything without the WHERE condition, but I'm stuck when I try to filter with this WHERE (completed < DATE('now', '-1 minute'))
The text was updated successfully, but these errors were encountered: