以毫秒为单位计算日期的代码是:
//installment date converted to milliseconds
long localDateInstall = installDate.getTime();
//installment date converted to milliseconds
long localDatePay = payDate.getTime();
在这里我计算这些日期之间的天数:
days=Math.abs((localDatePay - localDateInstall))/86400000;
当我想测试它时,我输入1/Jan/2012
forlocalDateInstall
和1/Feb/2012
for localDatePay
。结果是:29 天。问题是什么?谢谢