Here you can find the source of getDaySub(String beginDate, String endDate)
public static Long getDaySub(String beginDate, String endDate) throws Exception
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; public class Main { public static Long getDaySub(String beginDate, String endDate) throws Exception { Long days = 0L;/*from ww w .jav a 2 s . c o m*/ SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); days = (sdf.parse(endDate).getTime() - sdf.parse(beginDate).getTime()) / (24 * 60 * 60 * 1000); return days; } }