Home:ALL Converter>Android sqlite date comparison?

Android sqlite date comparison?

Ask Time:2010-10-25T18:02:45         Author:Jovan

Json Formatter

How can I compare dates using where statement in sqlite? I don't know how to write date in timestamp format in DB. I guess only timestamp format (integer or string in database) I can compare?!

Can someone help me with code for writing date in db (using ContentValues )

I want to use this code for comparison:

 Cursor mCursor =
             db.query(true,
               tableName,
               null, 
               KEY_DATETIME + " >= '"+ fromDate +"' and " +
                 KEY_DATETIME + " <= '"+ toDate +"'" , 
               null,
               null, 
               null, 
               null, 
               null);

Author:Jovan,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/4013508/android-sqlite-date-comparison
yy