Java Day End getDatesBetweenTwoDate(Date beginDate, Date endDate)

Here you can find the source of getDatesBetweenTwoDate(Date beginDate, Date endDate)

Description

get Dates Between Two Date

License

Open Source License

Declaration

public static List<Date> getDatesBetweenTwoDate(Date beginDate,
        Date endDate) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;

import java.util.List;

public class Main {

    public static List<Date> getDatesBetweenTwoDate(Date beginDate,
            Date endDate) {/*from   w w w. j ava 2 s . c  o m*/
        List<Date> dateList = new ArrayList<Date>();
        dateList.add(beginDate);
        Calendar cal = Calendar.getInstance();
        cal.setTime(beginDate);
        boolean bContinue = true;
        while (bContinue) {
            cal.add(Calendar.SECOND, 1);
            if (endDate.after(cal.getTime())) {
                dateList.add(cal.getTime());
            } else {
                break;
            }
        }
        dateList.add(endDate);
        return dateList;
    }
}

Related

  1. getDatebetweenOfDays(Date startDate, Date endDate)
  2. getDateEnd(java.util.Date d)
  3. getDateEndDay()
  4. getDateInterval4EndDate(Date date, int hourModify)
  5. getDateList(Date begin, Date end)
  6. getDateTimeString(boolean appendMillis)
  7. getDefaultEndDateForLogQuery()
  8. getDistDates(Date startDate, Date endDate)
  9. getEndDate()