我的Sqlite数据库中有一个字段(名为time,但type为TEXT).该列的当前格式为YYYY:MM:DD_HH:MM(2011:11:01_11:30).现在我必须对此专栏进行排序,所以我认为我必须做两件事:
那么我该如何将该列转换为DateTime?或者还有其他方法吗?
我想在一个方法中将date1(2013/1/21 21:22:30)与date2(now)进行比较
我想得到多少日期,小时,分钟和第二个剩余表格日期1
String mDate,mHour,mMinute,mSecond;
DateComparedateTime(String Date1)
{
// compare Date1 with now
mDate = Difference date with Date1 and Now;
mHour = Difference hour with Date1 and Now;
mMinute = Difference minute with Date1 and Now;
mSecond = Difference second with Date1 and Now;
}
Run Code Online (Sandbox Code Playgroud)
怎么能创建这个方法?