This question is locked. New answers and comments are not allowed.
Would it make sense to have a separate 'Plugin' area in the forums? I wasn't sure where to post this.
I have started using the SQLite plugin and thought i would share my experience with storing dates.
Before i begin does anyone know if there is a way to stop all the SQLitePlugin console messages appearing? there is a lot of them and it is hard to see all my own messages with the SQLitePlugin messages being displayed as well.
Dates:
Initially I tried storing dates in the database as an integer (ms from 1st Jan 1970) using getTime()
and then converting the interger back to a js Date Object using new Date(databaseValue)
This worked OK in Android 2.3 but for some reason in Android 4.03 the values were not being stored correctly, e.g. the number 1361836800000 became 332167168 when read back from the database. I've no idea why!
I then moved to storing the dates as TEXT in the format yyyy-MM-dd HH:mm:ss using kendo.toString(date, "yyyy-MM-dd HH:mm:ss") to convert the date to a string for saving in the db and new Date(strdate) to convert from database string back to a date.
This works in Android 2.3 & 4.03 but failed in IOS 5 AHHHHHH!!!
It turns out that some IOS browsers don't accept one of the most common datetime formats!! I finally ended up writing a date function that splits out the date elements from the string before converting then to a javascript Date object, so far so good, i hope this helps others.
if(!strdate)
return new Date(0);
else
{
arr = strdate.split(/[- :]/);
return new Date(arr[0], arr[1]-1, arr[2], arr[3], arr[4], arr[5]);
}
Kendo UI / Icenium Team, how about some more detailed demos using the SQLitePlugin please, the one I found was very basic, it would be good to see proper date manipulation and using it with kendo DataSource & MVVM scenarios.
I have started using the SQLite plugin and thought i would share my experience with storing dates.
Before i begin does anyone know if there is a way to stop all the SQLitePlugin console messages appearing? there is a lot of them and it is hard to see all my own messages with the SQLitePlugin messages being displayed as well.
Dates:
Initially I tried storing dates in the database as an integer (ms from 1st Jan 1970) using getTime()
and then converting the interger back to a js Date Object using new Date(databaseValue)
This worked OK in Android 2.3 but for some reason in Android 4.03 the values were not being stored correctly, e.g. the number 1361836800000 became 332167168 when read back from the database. I've no idea why!
I then moved to storing the dates as TEXT in the format yyyy-MM-dd HH:mm:ss using kendo.toString(date, "yyyy-MM-dd HH:mm:ss") to convert the date to a string for saving in the db and new Date(strdate) to convert from database string back to a date.
This works in Android 2.3 & 4.03 but failed in IOS 5 AHHHHHH!!!
It turns out that some IOS browsers don't accept one of the most common datetime formats!! I finally ended up writing a date function that splits out the date elements from the string before converting then to a javascript Date object, so far so good, i hope this helps others.
if(!strdate)
return new Date(0);
else
{
arr = strdate.split(/[- :]/);
return new Date(arr[0], arr[1]-1, arr[2], arr[3], arr[4], arr[5]);
}
Kendo UI / Icenium Team, how about some more detailed demos using the SQLitePlugin please, the one I found was very basic, it would be good to see proper date manipulation and using it with kendo DataSource & MVVM scenarios.