当前位置: 技术问答>java相关
如何将两个Date相差的天数求出来?
来源: 互联网 发布时间:2015-04-08
本文导语: Date d1 = new Date(1900,1,21); Date d2 = new Date(1920,10,20); | long time = Math.abs (d1.getTime ()-d2.getTime ()); int day = (int)(time /(24*3600*1000)); System.out.println("Days = "+day);
Date d1 = new Date(1900,1,21);
Date d2 = new Date(1920,10,20);
Date d2 = new Date(1920,10,20);
|
long time = Math.abs (d1.getTime ()-d2.getTime ());
int day = (int)(time /(24*3600*1000));
System.out.println("Days = "+day);
int day = (int)(time /(24*3600*1000));
System.out.println("Days = "+day);