Skip to content Skip to sidebar Skip to footer

Compare Date In Sql Statement

I am making an alert tool using web sql. I want to selects all events that occur in a specific day. when I insert the event I insert the date as a date object with this format '201

Solution 1:

I believe you want:

NOTE_DATE = '"+cur.getFullYear()+'-'+(cur.getMonth()+1)+'-'+cur.getDate()+"'

Note the ' wrapping the value for the query variable, and calling the cur date object's methods to construct the date.

http://jsfiddle.net/yXgDw/

Better yet, use a prepared query:

http://www.w3.org/TR/webdatabase/#dom-sqltransaction-executesql

http://www.w3.org/TR/webdatabase/#introduction

Post a Comment for "Compare Date In Sql Statement"