Here you can find the source of getDaysTo(Date date)
public static int getDaysTo(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Date; public class Main { private static final long ONE_DAY_IN_MILLIS = 24 * 60 * 60 * 1000; public static int getDaysTo(Date date) { return (int) ((date.getTime() - getCurrentEpochTime()) / ONE_DAY_IN_MILLIS); }//from ww w .jav a 2s . c o m private static long getCurrentEpochTime() { return new Date().getTime(); } }