2011-05-06 29 views
1

如何獲取日曆條目日期? dtStart返回我未知的值,這不是我的事件條目日期。Android日曆「dtStart」返回未知值

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:

事件:項目會議;事件發生日期:1304236800000

如果有人能幫忙,我將不勝感激。謝謝

***問題解決了。我需要時間戳轉換爲可讀的日期格式

Date date = new Date (date); 
SimpleDateFormat dateFormat = new SimpleDateFormat ("E-dd-MMM:HH:mm:ss-yyyy"); 
dateFormat.format(date); 

回答

1

這不是未知的時間,但UNIX時間戳,轉換提出here

+0

非常感謝。我的問題解決了。 – user741396 2011-05-06 09:22:58