I am querying events table in android to get events.
String[] projection = new String[] { "calendar_id", "title", "description",
"dtstart", "dtend", "eventLocation" };
Cursor cursor = cr.query(Uri.parse("content://com.android.calendar/events"),
projection,
null,
null,
null);
This returns all the events. But now I want events only in specific duration say 4/03/2013 to 7/03/2013. How do I use selection and selectionArgs[] ?
I tried this
String selection = "((dtstart <= ?) AND (dtend >= ?))";
String[] selectionArgs = new String[] {startString, endString};
But its not returning anything. My doubt are
1. Will where clause work ? Because, startDate and endDate are first converted to long (milliseconds) and then to String and then are stored in the table. So how can strings be compared for their long values. There is no toNumber() function in sqlite.
2. If I'm passing selectionArgs then startString and endString should be in which format ?