Here you can find the source of daysSince(long date)
public static int daysSince(long date)
//package com.java2s; //License from project: Apache License import java.util.Calendar; public class Main { public static int daysSince(long date) { final Calendar logDate = Calendar.getInstance(); logDate.setTimeInMillis(date);//from www .j av a2s . co m logDate.set(Calendar.SECOND, 0); logDate.set(Calendar.MINUTE, 0); logDate.set(Calendar.HOUR_OF_DAY, 0); final Calendar today = Calendar.getInstance(); today.set(Calendar.SECOND, 0); today.set(Calendar.MINUTE, 0); today.set(Calendar.HOUR_OF_DAY, 0); return (int) Math.round((today.getTimeInMillis() - logDate .getTimeInMillis()) / 86400000d); } }