Android calendar "dtStart" returns unknown value
How to get calendar entries date? dtStart returns me unknown value which is not my event entries date.
eventUri = Uri.parse("content://com.android.calendar/events");
Cursor cursor = this.getContentResolver().query(eventUri, null, null, null, null);
while(cursor.moveToNext()) {
int eventCol = cursor.getColumnIndex("title");
int dateCol = cursor.getColumnIndex("dtStart");
System.out.println("Event: " + cursor.getString(eventCol)
+ "; Date of Event: " + cursor.getString(dateCol));
}
OUTPUT:
Event: PROJECT MEETING ; Date of event: 1304236800000
Would appreciate if anyone can help. Thank you
***Problem is solved. I need to convert the timestamp to readable Date forma开发者_Python百科t
Date date = new Date (date);
SimpleDateFormat dateFormat = new SimpleDateFormat ("E-dd-MMM:HH:mm:ss-yyyy");
dateFormat.format(date);
This is not unknown time, but UNIX timestamp, conversion is proposed here.
精彩评论