private static int numDays(String start,String end){ Calendar startCal=Calendar.getInstance(); String arr[]=start.split("-"); startCal.set(Integer.parseInt(arr[0]), Integer.parseInt(arr[1]), Integer.parseInt(arr[2])); long startTime=startCal.getTimeInMillis(); arr=end.split("-"); Calendar endCal=Calendar.getInstance(); endCal.set(Integer.parseInt(arr[0]), Integer.parseInt(arr[1]), Integer.parseInt(arr[2])); long endTime=endCal.getTimeInMillis(); int num=Integer.parseInt(String.valueOf((endTime-startTime)/(1000*60*60*24))); return num; }