日期:2014-05-18 浏览次数:20996 次
public boolean getQuot(String time1) { boolean bool = false; long quot = 0; SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd"); try { Date date1 = ft.parse(time1); Date date2 = new Date(); if(date1.getTime()<date2.getTime()){ quot = date2.getTime()- date1.getTime(); quot = quot / 1000 / 60 / 60 / 24; if(quot>0){ bool = false; }else{ bool = true; } }else{ bool = false; } } catch (ParseException e) { e.printStackTrace(); } return bool; }
------解决方案--------------------
如果是要得到相差的天数只要要将一楼的quot = date2.getTime()- date1.getTime();
改成quot = parseInt(date2.getTime()- date1.getTime());
后面的不要了
------解决方案--------------------