是:
2011-03-27T09:39:01.607
和有当前的日期。
我想这两个日期之间差异的形式:
I want to get difference between these two dates in the form of :
2 days ago
1 minute ago etc..
根据过帐日期。
depending posting date.
现在用这个code张贴日期转换为钢厂秒:
Am using this code to convert posting date to mill seconds:
public long Date_to_MilliSeconds(int day, int month, int year, int hour, int minute)
{
Calendar c = Calendar.getInstance();
c.set(year, month, day, hour, minute, 00);
return c.getTimeInMillis();
}
这当前日期:长今= System.currentTimeMillis的();
和计算的区别:
String difference = (String) DateUtils.getRelativeTimeSpanString(time,now, 0);
但它返回像 1970年5月1日或东西..
如何获得过帐日期和当前日期之间的差异。
你得到1970年是因为它是在毫秒时代日期的理由。为了得到实际相差使用下面的。
The reason you get 1970 is because it is the epoch date in milli seconds. To get the actual difference use the below.
使用 JodaTime