Here you can find the source of GetDays(String strStartDate, String strEndDate)
public static long GetDays(String strStartDate, String strEndDate) throws Exception
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static long GetDays(String strStartDate, String strEndDate) throws Exception { DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Date d1 = df.parse(strStartDate); Date d2 = df.parse(strEndDate); long diff = d2.getTime() - d1.getTime(); return diff / (1000 * 60 * 60 * 24); }// w ww .j a va 2 s. c o m }