Here you can find the source of daySub(Date fDate, Date oDate)
public static int daySub(Date fDate, Date oDate)
//package com.java2s; //License from project: LGPL import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static int daySub(Date fDate, Date oDate) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); long to = fDate.getTime(); long from = oDate.getTime(); return (int) (to - from) / (1000 * 60 * 60 * 24); }//from w w w. java2s . c om }