【问题标题】:Android calendar "dtStart" returns unknown valueAndroid 日历“dtStart”返回未知值
【发布时间】:2011-05-06 08:51:57
【问题描述】:

如何获取日历条目日期? 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));

}

输出:

活动:项目会议;活动日期:1304236800000

如果有人可以提供帮助,我们将不胜感激。谢谢

***问题解决了。我需要将时间戳转换为可读的日期格式

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

【问题讨论】:

    标签: android calendar


    【解决方案1】:

    这不是未知时间,而是UNIX时间戳,建议转换here。

    【讨论】:

      猜你喜欢
      • 2012-11-24
      • 2011-12-14
      • 2011-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多