“直须看尽洛城花,始共春风容易别”
public Integer getDayDiff(String smdate,String bdate) {
long between_days = 0L;
try {
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance();
cal.setTime(sdf.parse(smdate));
long time1 = cal.getTimeInMillis();
cal.setTime(sdf.parse(bdate));
long time2 = cal.getTimeInMillis();
between_days=(time2-time1)/(1000*3600*24);
System.out.println();
}catch (Exception e) {
e.printStackTrace();
}
return Integer.parseInt(String.valueOf(between_days));
}