I'm writing an application in ExtJS that uses WebSQL to store data in a SQLite database in the browser. (The requirements are for only web-kit browsers, lucky me right?) I'm running into a problem with date fields.
I'm using ExtJS's datefields in my UI which handles Javascript dates. My SQLite schema uses datetime fields to store them. SQLite complains about a contraint violation when I save data, but the data still gets there so I don't really care.
The problem is that I need to do some date comparing in SQLite in order to populate an ExtJS grid. But because the date format is in the Javascript data format and not one of SQLite's acceptable datetime formats, doing my comparison in the sql doesn't work.
My sql can't compare the dates because it's not in the format that SQLite expects. How do I fix that?
I've tried using the Ext.Data.format() when saving the data to put it in a format that SQLite likes ("Y-m-d") but to no avail. I've also looked into converting from the Javascript Date format to the SQLite datetime format in my sql with the Date() function, but that hasn't worked either.
Any ideas?
dateobject, so the format is:Fri May 11 2012 20:32:54 GMT-0600 (MDT)