package Method; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; public class Dell_Calendar { /**¼ÆËã2¸öÈÕÆÚÏà²îµÄÌìÊýÄê-ÔÂ-ÈÕ¸ñʽ*/ public static int daysBetween(String startime,String endtime){ SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); Calendar cal = Calendar.getInstance(); try { cal.setTime(sdf.parse(startime)); } catch (ParseException e) { // TODO ×Ô¶¯Éú³ÉµÄ catch ¿é e.printStackTrace(); } long time1 = cal.getTimeInMillis(); try { cal.setTime(sdf.parse(endtime)); } catch (ParseException e) { // TODO ×Ô¶¯Éú³ÉµÄ catch ¿é e.printStackTrace(); } long time2 = cal.getTimeInMillis(); long between_days=(time2-time1)/(1000*3600*24); return Integer.parseInt(String.valueOf(between_days)); } }