Here you can find the source of subtractNowDay(Date date)
public static long subtractNowDay(Date date)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static long subtractNowDay(Date date) { final int aDaymi = 24 * 60 * 60 * 1000; Calendar calendar = Calendar.getInstance(); calendar.setTime(date);//from ww w .j a v a 2 s. c o m long dateTimeInMillis = calendar.getTimeInMillis(); Calendar nowCalendar = Calendar.getInstance(); nowCalendar.setTime(new Date()); long nowTimeInMillis = nowCalendar.getTimeInMillis(); return (nowTimeInMillis - dateTimeInMillis) / (aDaymi); } }