【发布时间】:2011-04-27 00:22:59
【问题描述】:
我在网络上尝试了不同的方法,但无法成功。
Cursor cursor = sqlite.myDataBase.rawQuery("SELECT StartDate, EndDate FROM Tracks Where Id="+'"'+trackId+'"',null);
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date startDate = outputFormat.parse(cursor.getString(cursor.getColumnIndex("StartDate")));
Date endDate = outputFormat.parse(cursor.getString(cursor.getColumnIndex("EndDate")));
通过这种方式,我得到了格式良好的两个日期。现在我想在几秒钟内找出EndDate 和Startdate 之间的区别。
有什么建议吗?谢谢。
【问题讨论】: