Here you can find the source of daysSince(Date since)
public static List<Date> daysSince(Date since)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static List<Date> daysSince(Date since) { List<Date> list = new ArrayList<Date>(); Date today = getMidnight(new Date()); for (Date d = getMidnight(since); d.before(today) || d.equals(today); d = newDateFrom(d, Calendar.DAY_OF_YEAR, 1)) { list.add(d);/*from ww w . ja va 2 s. c o m*/ } return list; } /** * @param date a date * @return a new date with same day, month and year as <code>date</code>, * but with hours, minutes and seconds set to zero. */ public static Date getMidnight(Date date) { if (date == null) throw new IllegalArgumentException("'date' was null"); Calendar c = Calendar.getInstance(); c.setTime(date); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); return c.getTime(); } public static Date newDateFrom(Date reference, int field, int distance) { Calendar c = Calendar.getInstance(); c.setTime(reference); c.add(field, distance); return c.getTime(); } }