Date endTime = new Date(System.currentTimeMillis()); //获取当前时间 long s = endTime.getTime()-startTime.getTime(); TimeUnit time = TimeUnit.DAYS; long days = time.convert(s, TimeUnit.MILLISECONDS); //days即相差天数

Date endTime = new Date(System.currentTimeMillis()); //获取当前时间 long s = endTime.getTime()-startTime.getTime(); TimeUnit time = TimeUnit.DAYS; long days = time.convert(s, TimeUnit.MILLISECONDS); //days即相差天数